\input{preamble}

% OK, start here.
%
\begin{document}

\title{Morphisms of Schemes}


\maketitle

\phantomsection
\label{section-phantom}

\tableofcontents

\section{Introduction}
\label{section-introduction}

\noindent
In this chapter we introduce some types of morphisms of schemes.
A basic reference is \cite{EGA}.




















\section{Closed immersions}
\label{section-closed-immersions}

\noindent
In this section we elucidate some of the results obtained previously on closed
immersions of schemes. Recall that a morphism of schemes $i : Z \to X$
is defined to be a closed immersion if (a) $i$ induces a homeomorphism onto
a closed subset of $X$, (b) $i^\sharp : \mathcal{O}_X \to i_*\mathcal{O}_Z$
is surjective, and (c) the kernel of $i^\sharp$ is locally generated by
sections, see Schemes, Definitions \ref{schemes-definition-immersion}
and \ref{schemes-definition-closed-immersion-locally-ringed-spaces}. It turns
out that, given that $Z$ and $X$ are schemes, there are many different
ways of characterizing a closed immersion.

\begin{lemma}
\label{lemma-closed-immersion}
Let $i : Z \to X$ be a morphism of schemes.
The following are equivalent:
\begin{enumerate}
\item The morphism $i$ is a closed immersion.
\item For every affine open $\Spec(R) = U \subset X$,
there exists an ideal $I \subset R$ such that
$i^{-1}(U) = \Spec(R/I)$ as schemes over $U = \Spec(R)$.
\item There exists an affine open covering $X = \bigcup_{j \in J} U_j$,
$U_j = \Spec(R_j)$ and for every $j \in J$ there exists
an ideal $I_j \subset R_j$ such that
$i^{-1}(U_j) = \Spec(R_j/I_j)$ as schemes over $U_j = \Spec(R_j)$.
\item The morphism $i$ induces a homeomorphism of $Z$ with a closed subset
of $X$ and $i^\sharp : \mathcal{O}_X \to i_*\mathcal{O}_Z$ is surjective.
\item The morphism $i$ induces a homeomorphism of $Z$ with a closed subset
of $X$, the map $i^\sharp : \mathcal{O}_X \to i_*\mathcal{O}_Z$ is surjective,
and the kernel $\Ker(i^\sharp)\subset \mathcal{O}_X$ is a quasi-coherent
sheaf of ideals.
\item The morphism $i$ induces a homeomorphism of $Z$ with a closed subset
of $X$, the map $i^\sharp : \mathcal{O}_X \to i_*\mathcal{O}_Z$ is surjective,
and the kernel $\Ker(i^\sharp)\subset \mathcal{O}_X$ is a
sheaf of ideals which is locally generated by sections.
\end{enumerate}
\end{lemma}

\begin{proof}
Condition (6) is our definition of a closed immersion, see Schemes,
Definitions \ref{schemes-definition-closed-immersion-locally-ringed-spaces}
and \ref{schemes-definition-immersion}.
So (6) $\Leftrightarrow$ (1). We have (1) $\Rightarrow$ (2) by
Schemes, Lemma \ref{schemes-lemma-closed-subspace-scheme}.
Trivially (2) $\Rightarrow$ (3).

\medskip\noindent
Assume (3). Each of the morphisms
$\Spec(R_j/I_j) \to \Spec(R_j)$ is
a closed immersion, see
Schemes, Example \ref{schemes-example-closed-immersion-affines}.
Hence $i^{-1}(U_j) \to U_j$ is a homeomorphism onto its image
and $i^\sharp|_{U_j}$ is surjective. Hence $i$ is a homeomorphism
onto its image and $i^\sharp$ is surjective since this may be
checked locally. We conclude that (3) $\Rightarrow$ (4).

\medskip\noindent
The implication (4) $\Rightarrow$ (1) is
Schemes, Lemma \ref{schemes-lemma-characterize-closed-immersions}.
The implication (5) $\Rightarrow$ (6) is trivial.
And the implication (6) $\Rightarrow$ (5) follows
from Schemes, Lemma \ref{schemes-lemma-closed-subspace-scheme}.
\end{proof}

\begin{lemma}
\label{lemma-closed-immersion-ideals}
Let $X$ be a scheme. Let $i : Z \to X$ and $i' : Z' \to X$
be closed immersions and consider the ideal sheaves
$\mathcal{I} = \Ker(i^\sharp)$ and $\mathcal{I}' = \Ker((i')^\sharp)$
of $\mathcal{O}_X$.
\begin{enumerate}
\item The morphism $i : Z \to X$ factors as $Z \to Z' \to X$
for some $a : Z \to Z'$ if and only if $\mathcal{I}' \subset \mathcal{I}$.
If this happens, then $a$ is a closed immersion.
\item We have $Z \cong Z'$ over $X$ if and only if
$\mathcal{I} = \mathcal{I}'$.
\end{enumerate}
\end{lemma}

\begin{proof}
This follows from our discussion of closed subspaces in
Schemes, Section \ref{schemes-section-closed-immersion} especially
Schemes, Lemmas
\ref{schemes-lemma-closed-immersion} and
\ref{schemes-lemma-characterize-closed-subspace}.
It also follows in a straightforward way from characterization
(3) in Lemma \ref{lemma-closed-immersion} above.
\end{proof}

\begin{lemma}
\label{lemma-closed-immersion-bijection-ideals}
Let $X$ be a scheme.
Let $\mathcal{I} \subset \mathcal{O}_X$ be a sheaf of ideals.
The following are equivalent:
\begin{enumerate}
\item $\mathcal{I}$ is locally generated by
sections as a sheaf of $\mathcal{O}_X$-modules,
\item $\mathcal{I}$ is quasi-coherent as
a sheaf of $\mathcal{O}_X$-modules, and
\item there exists a closed immersion $i : Z \to X$ of schemes whose
corresponding sheaf of ideals $\Ker(i^\sharp)$ is equal to $\mathcal{I}$.
\end{enumerate}
\end{lemma}

\begin{proof}
The equivalence of (1) and (2) is immediate from
Schemes, Lemma \ref{schemes-lemma-closed-subspace-scheme}.
If (1) holds, then there is a closed subspace $i : Z \to X$
with $\mathcal{I} = \Ker(i^\sharp)$ by
Schemes, Definition \ref{schemes-definition-closed-subspace}
and Example \ref{schemes-example-closed-subspace}.
By Schemes, Lemma \ref{schemes-lemma-closed-subspace-scheme}
this is a closed immersion of schemes and (3) holds.
Conversely, if (3) holds, then (2) holds by
Schemes, Lemma \ref{schemes-lemma-closed-subspace-scheme}
(which applies because a closed immersion of schemes is a fortiori a
closed immersion of locally ringed spaces).
\end{proof}

\begin{lemma}
\label{lemma-base-change-closed-immersion}
The base change of a closed immersion is a closed immersion.
\end{lemma}

\begin{proof}
See Schemes, Lemma \ref{schemes-lemma-base-change-immersion}.
\end{proof}

\begin{lemma}
\label{lemma-composition-closed-immersion}
A composition of closed immersions is a closed immersion.
\end{lemma}

\begin{proof}
We have seen this in
Schemes, Lemma \ref{schemes-lemma-composition-immersion},
but here is another
proof. Namely, it follows from the characterization (3) of closed immersions
in Lemma \ref{lemma-closed-immersion}. Since if $I \subset R$
is an ideal, and $\overline{J} \subset R/I$ is an ideal, then
$\overline{J} = J/I$ for some ideal $J \subset R$ which contains
$I$ and $(R/I)/\overline{J} = R/J$.
\end{proof}

\begin{lemma}
\label{lemma-closed-immersion-quasi-compact}
A closed immersion is quasi-compact.
\end{lemma}

\begin{proof}
This lemma is a duplicate of
Schemes, Lemma \ref{schemes-lemma-closed-immersion-quasi-compact}.
\end{proof}

\begin{lemma}
\label{lemma-closed-immersion-separated}
A closed immersion is separated.
\end{lemma}

\begin{proof}
This lemma is a special case of
Schemes, Lemma \ref{schemes-lemma-immersions-monomorphisms}.
\end{proof}





\section{Immersions}
\label{section-immersions}

\noindent
In this section we collect some facts on immersions.

\begin{lemma}
\label{lemma-immersion-permanence}
Let $Z \to Y \to X$ be morphisms of schemes.
\begin{enumerate}
\item If $Z \to X$ is an immersion, then $Z \to Y$ is an immersion.
\item If $Z \to X$ is a quasi-compact immersion and $Y \to X$ is
quasi-separated, then $Z \to Y$ is a quasi-compact immersion.
\item If $Z \to X$ is a closed immersion and $Y \to X$ is separated,
then $Z \to Y$ is a closed immersion.
\end{enumerate}
\end{lemma}

\begin{proof}
In each case the proof is to contemplate the commutative diagram
$$
\xymatrix{
Z \ar[r] \ar[rd] & Y \times_X Z \ar[r] \ar[d] & Z \ar[d] \\
& Y \ar[r] & X
}
$$
where the composition of the top horizontal arrows is the identity.
Let us prove (1). The first horizontal arrow is a section of
$Y \times_X Z \to Z$, whence an immersion by
Schemes, Lemma \ref{schemes-lemma-section-immersion}.
The arrow $Y \times_X Z \to Y$ is a base change of $Z \to X$ hence
an immersion (Schemes, Lemma \ref{schemes-lemma-base-change-immersion}).
Finally, a composition of immersions is an immersion
(Schemes, Lemma \ref{schemes-lemma-composition-immersion}). This proves (1).
The other two results are proved in exactly the same manner.
\end{proof}

\begin{lemma}
\label{lemma-factor-quasi-compact-immersion}
Let $h : Z \to X$ be an immersion.
If $h$ is quasi-compact, then we can factor
$h = i \circ j$ with $j : Z \to \overline{Z}$ an
open immersion and $i : \overline{Z} \to X$ a closed immersion.
\end{lemma}

\begin{proof}
Note that $h$ is quasi-compact and quasi-separated (see
Schemes, Lemma \ref{schemes-lemma-immersions-monomorphisms}).
Hence $h_*\mathcal{O}_Z$ is a quasi-coherent sheaf of $\mathcal{O}_X$-modules
by Schemes, Lemma \ref{schemes-lemma-push-forward-quasi-coherent}.
This implies that
$\mathcal{I} = \Ker(\mathcal{O}_X \to h_*\mathcal{O}_Z)$
is a quasi-coherent sheaf of ideals, see
Schemes, Section \ref{schemes-section-quasi-coherent}.
Let $\overline{Z} \subset X$ be the closed subscheme corresponding
to $\mathcal{I}$, see Lemma \ref{lemma-closed-immersion-bijection-ideals}.
By Schemes, Lemma \ref{schemes-lemma-characterize-closed-subspace}
the morphism $h$ factors as
$h = i \circ j$ where $i : \overline{Z} \to X$ is the inclusion morphism.
To see that $j$ is an open immersion, choose an open subscheme
$U \subset X$ such that $h$ induces a closed immersion of $Z$
into $U$. Then it is clear that $\mathcal{I}|_U$ is the
sheaf of ideals corresponding to the closed immersion $Z \to U$.
Hence we see that $Z = \overline{Z} \cap U$.
\end{proof}

\begin{lemma}
\label{lemma-factor-reduced-immersion}
Let $h : Z \to X$ be an immersion.
If $Z$ is reduced, then we can factor
$h = i \circ j$ with $j : Z \to \overline{Z}$ an
open immersion and $i : \overline{Z} \to X$ a closed immersion.
\end{lemma}

\begin{proof}
Let $\overline{Z} \subset X$ be the closure of $h(Z)$ with the reduced
induced closed subscheme structure, see
Schemes, Definition \ref{schemes-definition-reduced-induced-scheme}.
By Schemes, Lemma \ref{schemes-lemma-map-into-reduction}
the morphism $h$ factors as
$h = i \circ j$ with $i : \overline{Z} \to X$ the inclusion morphism
and $j : Z \to \overline{Z}$. From the definition of an immersion we
see there exists an open subscheme $U \subset X$ such that
$h$ factors through a closed immersion into $U$. Hence
$\overline{Z} \cap U$ and $h(Z)$ are reduced closed subschemes
of $U$ with the same underlying closed set. Hence by the uniqueness
in Schemes, Lemma \ref{schemes-lemma-reduced-closed-subscheme}
we see that $h(Z) \cong \overline{Z} \cap U$.
So $j$ induces an isomorphism of $Z$ with $\overline{Z} \cap U$.
In other words $j$ is an open immersion.
\end{proof}



\begin{example}
\label{example-thibaut}
Here is an example of an immersion which is not a composition of an
open immersion followed by a closed immersion.
Let $k$ be a field.
Let $X = \Spec(k[x_1, x_2, x_3, \ldots])$.
Let $U = \bigcup_{n = 1}^{\infty} D(x_n)$.
Then $U \to X$ is an open immersion.
Consider the ideals
$$
I_n =
(x_1^n, x_2^n, \ldots, x_{n - 1}^n, x_n - 1, x_{n + 1}, x_{n + 2}, \ldots)
\subset
k[x_1, x_2, x_3, \ldots][1/x_n].
$$
Note that $I_n k[x_1, x_2, x_3, \ldots][1/x_nx_m] = (1)$
for any $m \not = n$. Hence the quasi-coherent ideals
$\widetilde I_n$ on $D(x_n)$ agree on $D(x_nx_m)$, namely
$\widetilde I_n|_{D(x_nx_m)} = \mathcal{O}_{D(x_n x_m)}$ if
$n \not = m$. Hence these ideals glue to a quasi-coherent sheaf of ideals
$\mathcal{I} \subset \mathcal{O}_U$.
Let $Z \subset U$ be the closed subscheme corresponding to
$\mathcal{I}$. Thus $Z \to X$ is an immersion.

\medskip\noindent
We claim that we cannot factor $Z \to X$ as
$Z \to \overline{Z} \to X$, where $\overline{Z} \to X$ is closed
and $Z \to \overline{Z}$ is open. Namely, $\overline{Z}$ would
have to be defined by an ideal $I \subset k[x_1, x_2, x_3, \ldots]$
such that $I_n = I k[x_1, x_2, x_3, \ldots][1/x_n]$.
But the only element $f \in k[x_1, x_2, x_3, \ldots]$
which ends up in all $I_n$ is $0$! Hence $I$ does not exist.
\end{example}

\begin{lemma}
\label{lemma-check-immersion}
Let $f : Y \to X$ be a morphism of schemes. If for all $y \in Y$
there is an open subscheme $f(y) \in U \subset X$ such that
$f|_{f^{-1}(U)} : f^{-1}(U) \to U$ is an immersion, then $f$ is
an immersion.
\end{lemma}

\begin{proof}
This statement follows readily from the discussion of closed subschemes
at the end of Schemes, Section \ref{schemes-section-immersions}
but we will also give a detailed proof.
Let $Z \subset X$ be the closure of $f(Y)$. Since taking closures
commutes with restricting to opens, we see from the assumption that
$f(Y) \subset Z$ is open. Hence $Z' = Z \setminus f(Y)$ is closed.
Hence $X' = X \setminus Z'$ is an open subscheme of $X$ and
$f$ factors as $f : Y \to X'$ followed by the inclusion.
If $y \in Y$ and $U \subset X$ is as in the statement
of the lemma, then $U' = X' \cap U$ is an open neighbourhood
of $f'(y)$ such that $(f')^{-1}(U') \to U'$ is an immersion
(Lemma \ref{lemma-immersion-permanence}) with closed image.
Hence it is a closed immersion, see
Schemes, Lemma \ref{schemes-lemma-immersion-when-closed}.
Since being a closed immersion is local on the target
(for example by Lemma \ref{lemma-closed-immersion})
we conclude that $f'$ is a closed immersion as desired.
\end{proof}








\section{Closed immersions and quasi-coherent sheaves}
\label{section-closed-immersions-quasi-coherent}

\noindent
The following lemma finally does for quasi-coherent sheaves on schemes
what Modules, Lemma \ref{modules-lemma-i-star-exact} does for abelian sheaves.
See also the discussion in
Modules, Section \ref{modules-section-closed-immersion}.

\begin{lemma}
\label{lemma-i-star-equivalence}
Let $i : Z \to X$ be a closed immersion of schemes. Let
$\mathcal{I} \subset \mathcal{O}_X$ be the quasi-coherent sheaf of ideals
cutting out $Z$. The functor
$$
i_* :
\QCoh(\mathcal{O}_Z)
\longrightarrow
\QCoh(\mathcal{O}_X)
$$
is exact, fully faithful, with essential image those quasi-coherent
$\mathcal{O}_X$-modules $\mathcal{G}$ such that $\mathcal{I}\mathcal{G} = 0$.
\end{lemma}

\begin{proof}
A closed immersion is quasi-compact and separated, see
Lemmas \ref{lemma-closed-immersion-quasi-compact} and
\ref{lemma-closed-immersion-separated}. Hence
Schemes, Lemma \ref{schemes-lemma-push-forward-quasi-coherent}
applies and the pushforward of a quasi-coherent
sheaf on $Z$ is indeed a quasi-coherent sheaf on $X$.

\medskip\noindent
By Modules, Lemma \ref{modules-lemma-i-star-equivalence}
the functor $i_*$ is fully faithful.

\medskip\noindent
Now we turn to the description of the essential image of the
functor $i_*$. We have $\mathcal{I}(i_*\mathcal{F}) = 0$
for any quasi-coherent $\mathcal{O}_Z$-module, for example by
Modules, Lemma \ref{modules-lemma-i-star-equivalence}.
Next, suppose that $\mathcal{G}$
is any quasi-coherent $\mathcal{O}_X$-module such that
$\mathcal{I}\mathcal{G} = 0$. It suffices to show that the canonical map
$$
\mathcal{G} \longrightarrow i_* i^*\mathcal{G}
$$
is an isomorphism\footnote{This was proved in a more general situation
in the proof of  Modules, Lemma \ref{modules-lemma-i-star-equivalence}.}.
In the case of schemes and quasi-coherent modules, working affine locally
on $X$ and using Lemma \ref{lemma-closed-immersion} and
Schemes, Lemma \ref{schemes-lemma-widetilde-pullback}
it suffices to prove the following algebraic statement: Given a ring
$R$, an ideal $I$ and an $R$-module $N$ such that $IN = 0$ the canonical map
$$
N \longrightarrow N \otimes_R R/I,\quad
n \longmapsto n \otimes 1
$$
is an isomorphism of $R$-modules. Proof of this easy algebra fact is omitted.
\end{proof}

\noindent
Let $i : Z \to X$ be a closed immersion. Because of the lemma above we often,
by abuse of notation, denote $\mathcal{F}$ the sheaf $i_*\mathcal{F}$ on $X$.

\begin{lemma}
\label{lemma-largest-quasi-coherent-subsheaf}
Let $X$ be a scheme. Let $\mathcal{F}$ be a quasi-coherent
$\mathcal{O}_X$-module. Let $\mathcal{G} \subset \mathcal{F}$
be a $\mathcal{O}_X$-submodule. There exists a unique quasi-coherent
$\mathcal{O}_X$-submodule $\mathcal{G}' \subset \mathcal{G}$
with the following property: For every quasi-coherent $\mathcal{O}_X$-module
$\mathcal{H}$ the map
$$
\Hom_{\mathcal{O}_X}(\mathcal{H}, \mathcal{G}')
\longrightarrow
\Hom_{\mathcal{O}_X}(\mathcal{H}, \mathcal{G})
$$
is bijective. In particular $\mathcal{G}'$ is the largest quasi-coherent
$\mathcal{O}_X$-submodule of $\mathcal{F}$ contained in $\mathcal{G}$.
\end{lemma}

\begin{proof}
Let $\mathcal{G}_a$, $a \in A$ be the set of quasi-coherent
$\mathcal{O}_X$-submodules contained in $\mathcal{G}$.
Then the image $\mathcal{G}'$ of
$$
\bigoplus\nolimits_{a \in A} \mathcal{G}_a \longrightarrow \mathcal{F}
$$
is quasi-coherent as the image of a map of quasi-coherent sheaves
on $X$ is quasi-coherent and since a direct sum of quasi-coherent sheaves
is quasi-coherent, see
Schemes, Section \ref{schemes-section-quasi-coherent}.
The module $\mathcal{G}'$ is contained in $\mathcal{G}$. Hence this is the
largest quasi-coherent $\mathcal{O}_X$-module contained in $\mathcal{G}$.

\medskip\noindent
To prove the formula, let $\mathcal{H}$ be a quasi-coherent
$\mathcal{O}_X$-module and let $\alpha : \mathcal{H} \to \mathcal{G}$
be an $\mathcal{O}_X$-module map. The image of the composition
$\mathcal{H} \to \mathcal{G} \to \mathcal{F}$ is quasi-coherent
as the image of a map of quasi-coherent sheaves. Hence it is contained
in $\mathcal{G}'$. Hence $\alpha$ factors through $\mathcal{G}'$
as desired.
\end{proof}

\begin{lemma}
\label{lemma-i-upper-shriek}
Let $i : Z \to X$ be a closed immersion of schemes.
There is a functor\footnote{This is likely nonstandard notation.}
$i^! : \QCoh(\mathcal{O}_X) \to \QCoh(\mathcal{O}_Z)$
which is a right adjoint to $i_*$. (Compare
Modules, Lemma \ref{modules-lemma-i-star-right-adjoint}.)
\end{lemma}

\begin{proof}
Given quasi-coherent $\mathcal{O}_X$-module $\mathcal{G}$ we consider
the subsheaf $\mathcal{H}_Z(\mathcal{G})$ of $\mathcal{G}$ of local sections
annihilated by $\mathcal{I}$. By
Lemma \ref{lemma-largest-quasi-coherent-subsheaf}
there is a canonical largest quasi-coherent $\mathcal{O}_X$-submodule
$\mathcal{H}_Z(\mathcal{G})'$. By construction we have
$$
\Hom_{\mathcal{O}_X}(i_*\mathcal{F}, \mathcal{H}_Z(\mathcal{G})')
=
\Hom_{\mathcal{O}_X}(i_*\mathcal{F}, \mathcal{G})
$$
for any quasi-coherent $\mathcal{O}_Z$-module $\mathcal{F}$.
Hence we can set $i^!\mathcal{G} = i^*(\mathcal{H}_Z(\mathcal{G})')$.
Details omitted.
\end{proof}

\noindent
Using the $1$-to-$1$ corresponding between quasi-coherent sheaves
of ideals and closed subschemes (see
Lemma \ref{lemma-closed-immersion-bijection-ideals})
we can define scheme theoretic intersections and unions
of closed subschemes.

\begin{definition}
\label{definition-scheme-theoretic-intersection-union}
Let $X$ be a scheme. Let $Z, Y \subset X$ be closed subschemes
corresponding to quasi-coherent ideal sheaves
$\mathcal{I}, \mathcal{J} \subset \mathcal{O}_X$.
The {\it scheme theoretic intersection} of $Z$ and $Y$
is the closed subscheme of $X$ cut out by $\mathcal{I} + \mathcal{J}$.
The {\it scheme theoretic union} of $Z$ and $Y$
is the closed subscheme of $X$ cut out by
$\mathcal{I} \cap \mathcal{J}$.
\end{definition}

\begin{lemma}
\label{lemma-scheme-theoretic-intersection}
Let $X$ be a scheme. Let $Z, Y \subset X$ be closed subschemes.
Let $Z \cap Y$ be the scheme theoretic intersection of $Z$ and $Y$.
Then $Z \cap Y \to Z$ and $Z \cap Y \to Y$ are closed immersions
and
$$
\xymatrix{
Z \cap Y \ar[r] \ar[d] & Z \ar[d] \\
Y \ar[r] & X
}
$$
is a cartesian diagram of schemes, i.e., $Z \cap Y = Z \times_X Y$.
\end{lemma}

\begin{proof}
The morphisms $Z \cap Y \to Z$ and $Z \cap Y \to Y$ are closed immersions
by Lemma \ref{lemma-closed-immersion-ideals}.
Let $U = \Spec(A)$ be an affine open of $X$ and let $Z \cap U$ and $Y \cap U$
correspond to the ideals $I \subset A$ and $J \subset A$. Then
$Z \cap Y \cap U$ corresponds to $I + J \subset A$. Since
$A/I \otimes_A A/J = A/(I + J)$ we see that the diagram is
cartesian by our description of fibre products of schemes
in Schemes, Section \ref{schemes-section-fibre-products}.
\end{proof}

\begin{lemma}
\label{lemma-scheme-theoretic-union}
Let $S$ be a scheme. Let $X, Y \subset S$ be closed subschemes.
Let $X \cup Y$ be the scheme theoretic union of $X$ and $Y$.
Let $X \cap Y$ be the scheme theoretic intersection of $X$ and $Y$.
Then $X \to X \cup Y$ and $Y \to X \cup Y$ are closed immersions, there is a
short exact sequence
$$
0 \to \mathcal{O}_{X \cup Y} \to \mathcal{O}_X \times \mathcal{O}_Y
\to \mathcal{O}_{X \cap Y} \to 0
$$
of $\mathcal{O}_S$-modules, and the diagram
$$
\xymatrix{
X \cap Y \ar[r] \ar[d] & X \ar[d] \\
Y \ar[r] & X \cup Y
}
$$
is cocartesian in the category of schemes, i.e.,
$X \cup Y = X \amalg_{X \cap Y} Y$.
\end{lemma}

\begin{proof}
The morphisms $X \to X \cup Y$ and $Y \to X \cup Y$ are closed immersions
by Lemma \ref{lemma-closed-immersion-ideals}. In the short exact sequence
we use the equivalence of Lemma \ref{lemma-i-star-equivalence} to think of
quasi-coherent modules on closed subschemes of $S$ as quasi-coherent modules
on $S$. For the first map in the sequence we use the canonical maps
$\mathcal{O}_{X \cup Y} \to \mathcal{O}_X$ and
$\mathcal{O}_{X \cup Y} \to \mathcal{O}_Y$
and for the second map we use the canonical map
$\mathcal{O}_X \to \mathcal{O}_{X \cap Y}$ and
the negative of the canonical map
$\mathcal{O}_Y \to \mathcal{O}_{X \cap Y}$. Then to check
exactness we may work affine locally.
Let $U = \Spec(A)$ be an affine open of $S$ and let $X \cap U$ and $Y \cap U$
correspond to the ideals $I \subset A$ and $J \subset A$. Then
$(X \cup Y) \cap U$ corresponds to $I \cap J \subset A$
and $X \cap Y \cap U$ corresponds to $I + J \subset A$.
Thus exactness follows from the exactness of
$$
0 \to A/I \cap J \to A/I \times A/J \to A/(I + J) \to 0
$$
To show the diagram is cocartesian, suppose we are given a scheme $T$
and morphisms of schemes $f : X \to T$, $g : Y \to T$ agreeing
as morphisms $X \cap Y \to T$. Goal: Show there exists a unique
morphism $h : X \cup Y \to T$ agreeing with $f$ and $g$.
To construct $h$ we may work affine locally on $X \cup Y$, see
Schemes, Section \ref{schemes-section-glueing-schemes}.
If $s \in X$, $s \not \in Y$, then $X \to X \cup Y$ is
an isomorphism in a neighbourhood of $s$ and it is clear
how to construct $h$. Similarly for $s \in Y$, $s \not \in X$.
For $s \in X \cap Y$ we can pick an affine open
$V = \Spec(B) \subset T$ containing $f(s) = g(s)$.
Then we can choose an affine open $U = \Spec(A) \subset S$
containing $s$ such that $f(X \cap U)$ and $g(Y \cap U)$
are contained in $V$. The morphisms $f|_{X \cap U}$
and $g|_{Y \cap V}$ into $V$ correspond to ring maps
$$
B \to A/I
\quad\text{and}\quad
B \to A/J
$$
which agree as maps into $A/(I + J)$. By the short exact sequence
displayed above there is a unique lift of these ring homomorphism
to a ring map $B \to A/I \cap J$ as desired.
\end{proof}









\section{Supports of modules}
\label{section-support}

\noindent
In this section we collect some elementary results on supports of
quasi-coherent modules on schemes.
Recall that the support of a sheaf of modules has been defined in
Modules, Section \ref{modules-section-support}.
On the other hand, the support of a module was defined in
Algebra, Section \ref{algebra-section-support}.
These match.

\begin{lemma}
\label{lemma-support-affine-open}
Let $X$ be a scheme. Let $\mathcal{F}$ be a quasi-coherent sheaf on $X$.
Let $\Spec(A) = U \subset X$ be an affine open, and set
$M = \Gamma(U, \mathcal{F})$.
Let $x \in U$, and let $\mathfrak p \subset A$ be the corresponding prime.
The following are equivalent
\begin{enumerate}
\item $\mathfrak p$ is in the support of $M$, and
\item $x$ is in the support of $\mathcal{F}$.
\end{enumerate}
\end{lemma}

\begin{proof}
This follows from the equality $\mathcal{F}_x = M_{\mathfrak p}$, see
Schemes, Lemma \ref{schemes-lemma-spec-sheaves}
and the definitions.
\end{proof}

\begin{lemma}
\label{lemma-support-closed-specialization}
Let $X$ be a scheme.
Let $\mathcal{F}$ be a quasi-coherent sheaf on $X$.
The support of $\mathcal{F}$ is closed under specialization.
\end{lemma}

\begin{proof}
If $x' \leadsto x$ is a specialization and $\mathcal{F}_x = 0$
then $\mathcal{F}_{x'}$ is zero, as $\mathcal{F}_{x'}$ is a localization
of the module $\mathcal{F}_x$. Hence the complement of
$\text{Supp}(\mathcal{F})$ is closed under generalization.
\end{proof}

\noindent
For finite type quasi-coherent modules the support is closed,
can be checked on fibres, and commutes with base change.

\begin{lemma}
\label{lemma-support-finite-type}
Let $\mathcal{F}$ be a finite type quasi-coherent module
on a scheme $X$. Then
\begin{enumerate}
\item The support of $\mathcal{F}$ is closed.
\item For $x \in X$ we have
$$
x \in \text{Supp}(\mathcal{F})
\Leftrightarrow
\mathcal{F}_x \not = 0
\Leftrightarrow
\mathcal{F}_x \otimes_{\mathcal{O}_{X, x}} \kappa(x) \not = 0.
$$
\item For any morphism of schemes $f : Y \to X$ the pullback
$f^*\mathcal{F}$ is of finite type as well and we have
$\text{Supp}(f^*\mathcal{F}) = f^{-1}(\text{Supp}(\mathcal{F}))$.
\end{enumerate}
\end{lemma}

\begin{proof}
Part (1) is a reformulation of
Modules, Lemma \ref{modules-lemma-support-finite-type-closed}.
You can also combine
Lemma \ref{lemma-support-affine-open},
Properties, Lemma \ref{properties-lemma-finite-type-module},
and
Algebra, Lemma \ref{algebra-lemma-support-closed}
to see this. The first equivalence in (2) is the definition
of support, and the second equivalence follows from
Nakayama's lemma, see
Algebra, Lemma \ref{algebra-lemma-NAK}.
Let $f : Y \to X$ be a morphism of schemes. Note that
$f^*\mathcal{F}$ is of finite type by
Modules, Lemma \ref{modules-lemma-pullback-finite-type}.
For the final assertion, let $y \in Y$ with image $x \in X$.
Recall that
$$
(f^*\mathcal{F})_y =
\mathcal{F}_x \otimes_{\mathcal{O}_{X, x}} \mathcal{O}_{Y, y},
$$
see
Sheaves, Lemma \ref{sheaves-lemma-stalk-pullback-modules}.
Hence $(f^*\mathcal{F})_y \otimes \kappa(y)$ is nonzero
if and only if $\mathcal{F}_x \otimes \kappa(x)$ is nonzero.
By (2) this implies $x \in \text{Supp}(\mathcal{F})$ if and only
if $y \in \text{Supp}(f^*\mathcal{F})$, which is the content of
assertion (3).
\end{proof}

\begin{lemma}
\label{lemma-scheme-theoretic-support}
Let $\mathcal{F}$ be a finite type quasi-coherent module
on a scheme $X$. There exists a smallest closed subscheme
$i : Z \to X$ such that there exists a quasi-coherent
$\mathcal{O}_Z$-module $\mathcal{G}$ with
$i_*\mathcal{G} \cong \mathcal{F}$. Moreover:
\begin{enumerate}
\item If $\Spec(A) \subset X$ is any affine open, and
$\mathcal{F}|_{\Spec(A)} = \widetilde{M}$ then
$Z \cap \Spec(A) = \Spec(A/I)$ where $I = \text{Ann}_A(M)$.
\item The quasi-coherent sheaf $\mathcal{G}$ is unique up to unique
isomorphism.
\item The quasi-coherent sheaf $\mathcal{G}$ is of finite type.
\item The support of $\mathcal{G}$ and of $\mathcal{F}$ is $Z$.
\end{enumerate}
\end{lemma}

\begin{proof}
Suppose that $i' : Z' \to X$ is a closed subscheme which satisfies the
description on open affines from the lemma. Then by
Lemma \ref{lemma-i-star-equivalence}
we see that $\mathcal{F} \cong i'_*\mathcal{G}'$ for some unique
quasi-coherent sheaf $\mathcal{G}'$ on $Z'$. Furthermore, it is clear
that $Z'$ is the smallest closed subscheme with this property (by the
same lemma). Finally, using
Properties, Lemma \ref{properties-lemma-finite-type-module}
and
Algebra, Lemma \ref{algebra-lemma-finite-over-subring}
it follows that $\mathcal{G}'$ is of finite type. We have
$\text{Supp}(\mathcal{G}') = Z$ by
Algebra, Lemma \ref{algebra-lemma-support-closed}.
Hence, in order to prove the lemma it suffices to show that
the characterization in (1) actually does define a closed subscheme.
And, in order to do this it suffices to prove that the given rule
produces a quasi-coherent sheaf of ideals, see
Lemma \ref{lemma-closed-immersion-bijection-ideals}.
This comes down to the following algebra fact: If $A$ is a ring, $f \in A$,
and $M$ is a finite $A$-module, then
$\text{Ann}_A(M)_f = \text{Ann}_{A_f}(M_f)$.
We omit the proof.
\end{proof}

\begin{definition}
\label{definition-scheme-theoretic-support}
Let $X$ be a scheme. Let $\mathcal{F}$ be a quasi-coherent
$\mathcal{O}_X$-module of finite type. The {\it scheme theoretic support
of $\mathcal{F}$} is the closed subscheme $Z \subset X$ constructed in
Lemma \ref{lemma-scheme-theoretic-support}.
\end{definition}

\noindent
In this situation we often think of $\mathcal{F}$ as a quasi-coherent
sheaf of finite type on $Z$ (via the equivalence of categories of
Lemma \ref{lemma-i-star-equivalence}).













\section{Scheme theoretic image}
\label{section-scheme-theoretic-image}

\noindent
Caution: Some of the material in this section is ultra-general and
behaves differently from what you might expect.

\begin{lemma}
\label{lemma-scheme-theoretic-image}
Let $f : X \to Y$ be a morphism of schemes. There exists a closed
subscheme $Z \subset Y$ such that $f$ factors through $Z$ and such
that for any other closed subscheme $Z' \subset Y$ such that $f$
factors through $Z'$ we have $Z \subset Z'$.
\end{lemma}

\begin{proof}
Let $\mathcal{I} = \Ker(\mathcal{O}_Y \to f_*\mathcal{O}_X)$.
If $\mathcal{I}$ is quasi-coherent then we just take $Z$ to be the
closed subscheme determined by $\mathcal{I}$, see
Lemma \ref{lemma-closed-immersion-bijection-ideals}. This works by
Lemma \ref{lemma-closed-immersion-ideals}.
In general the same lemma requires us to show that there exists
a largest quasi-coherent sheaf of ideals $\mathcal{I}'$ contained in
$\mathcal{I}$.
This follows from Lemma \ref{lemma-largest-quasi-coherent-subsheaf}.
\end{proof}

\begin{definition}
\label{definition-scheme-theoretic-image}
Let $f : X \to Y$ be a morphism of schemes. The {\it scheme theoretic image}
of $f$ is the smallest closed subscheme $Z \subset Y$ through which $f$
factors, see Lemma \ref{lemma-scheme-theoretic-image} above.
\end{definition}

\noindent
For a morphism $f : X \to Y$ of schemes with scheme theoretic image $Z$
we often denote $f : X \to Z$ the factorization of $f$
through its scheme theoretic image. If the morphism $f$ is not
quasi-compact, then (in general)
\begin{enumerate}
\item the set theoretic inclusion $\overline{f(X)} \subset Z$
is not an equality, i.e., $f(X) \subset Z$ is not a dense subset, and
\item the construction of the scheme theoretic image does not commute with
restriction to open subschemes to $Y$.
\end{enumerate}
In Examples, Section \ref{examples-section-scheme-theoretic-image}
the reader finds an example for both phenomena.
These phenomena can arise even for immersions, see
Examples, Section \ref{examples-section-strange-immersion}.
However, the next lemma shows that both disasters are avoided
when the morphism is quasi-compact.

\begin{lemma}
\label{lemma-quasi-compact-scheme-theoretic-image}
Let $f : X \to Y$ be a morphism of schemes.
Let $Z \subset Y$ be the scheme theoretic image of $f$.
If $f$ is quasi-compact then
\begin{enumerate}
\item the sheaf of ideals
$\mathcal{I} = \Ker(\mathcal{O}_Y \to f_*\mathcal{O}_X)$
is quasi-coherent,
\item the scheme theoretic image $Z$ is the closed subscheme
determined by $\mathcal{I}$,
\item for any open $U \subset Y$ the scheme theoretic image of
$f|_{f^{-1}(U)} : f^{-1}(U) \to U$ is equal to $Z \cap U$, and
\item the image $f(X) \subset Z$ is a dense subset of $Z$, in other
words the morphism $X \to Z$ is dominant
(see Definition \ref{definition-dominant}).
\end{enumerate}
\end{lemma}

\begin{proof}
Part (4) follows from part (3). To show (3) it suffices
to prove (1) since the formation of $\mathcal{I}$ commutes with restriction to
open subschemes of $Y$. And if (1) holds then in the proof of
Lemma \ref{lemma-scheme-theoretic-image}
we showed (2). Thus it suffices to prove that $\mathcal{I}$ is quasi-coherent.
Since the property of being quasi-coherent is
local we may assume $Y$ is affine. As $f$ is quasi-compact,
we can find a finite affine open covering
$X = \bigcup_{i = 1, \ldots, n} U_i$. Denote $f'$ the composition
$$
X' = \coprod U_i \longrightarrow X \longrightarrow Y.
$$
Then $f_*\mathcal{O}_X$ is a subsheaf of $f'_*\mathcal{O}_{X'}$,
and hence $\mathcal{I} = \Ker(\mathcal{O}_Y \to f'_*\mathcal{O}_{X'})$.
By Schemes, Lemma \ref{schemes-lemma-push-forward-quasi-coherent}
the sheaf $f'_*\mathcal{O}_{X'}$ is quasi-coherent on $Y$. Hence we win.
\end{proof}

\begin{example}
\label{example-scheme-theoretic-image}
If $A \to B$ is a ring map with kernel $I$, then the scheme theoretic image
of $\Spec(B) \to \Spec(A)$ is the closed subscheme
$\Spec(A/I)$ of $\Spec(A)$. This follows from
Lemma \ref{lemma-quasi-compact-scheme-theoretic-image}.
\end{example}

\noindent
If the morphism is quasi-compact, then the scheme theoretic image only
adds points which are specializations of points in the image.

\begin{lemma}
\label{lemma-reach-points-scheme-theoretic-image}
Let $f : X \to Y$ be a quasi-compact morphism.
Let $Z$ be the scheme theoretic image of $f$.
Let $z \in Z$\footnote{By
Lemma \ref{lemma-quasi-compact-scheme-theoretic-image} set-theoretically
$Z$ agrees with the closure of $f(X)$ in $Y$.}.
There exists a valuation ring $A$ with
fraction field $K$ and a commutative diagram
$$
\xymatrix{
\Spec(K) \ar[rr] \ar[d] & & X \ar[d] \ar[ld] \\
\Spec(A) \ar[r] & Z \ar[r] & Y
}
$$
such that the closed point of $\Spec(A)$ maps to $z$. In particular
any point of $Z$ is the specialization of a point of $f(X)$.
\end{lemma}

\begin{proof}
Let $z \in \Spec(R) = V \subset Y$ be an affine open
neighbourhood of $z$. By
Lemma \ref{lemma-quasi-compact-scheme-theoretic-image}
the intersection $Z \cap V$ is the scheme theoretic image of
$f^{-1}(V) \to V$. Hence we may replace $Y$ by $V$
and assume $Y = \Spec(R)$ is affine.
In this case $X$ is quasi-compact as $f$ is quasi-compact.
Say $X = U_1 \cup \ldots \cup U_n$
is a finite affine open covering. Write $U_i = \Spec(A_i)$.
Let $I = \Ker(R \to A_1 \times \ldots \times A_n)$.
By Lemma \ref{lemma-quasi-compact-scheme-theoretic-image}
again we see that $Z$ corresponds to the closed subscheme
$\Spec(R/I)$ of $Y$. If $\mathfrak p \subset R$ is
the prime corresponding to $z$, then we see that
$I_{\mathfrak p} \subset R_{\mathfrak p}$ is not an
equality. Hence (as localization is exact, see
Algebra, Proposition \ref{algebra-proposition-localization-exact})
we see that
$R_{\mathfrak p} \to
(A_1)_{\mathfrak p} \times \ldots \times (A_n)_{\mathfrak p}$
is not zero. Hence one of the rings $(A_i)_{\mathfrak p}$ is not zero.
Hence there exists an $i$ and a prime $\mathfrak q_i \subset A_i$
lying over a prime $\mathfrak p_i \subset \mathfrak p$.
By Algebra, Lemma \ref{algebra-lemma-dominate} we can choose a valuation ring
$A \subset K = \kappa(\mathfrak q_i)$ dominating
the local ring
$R_{\mathfrak p}/\mathfrak p_iR_{\mathfrak p} \subset \kappa(\mathfrak q_i)$.
This gives the desired diagram. Some details omitted.
\end{proof}

\begin{lemma}
\label{lemma-factor-factor}
Let
$$
\xymatrix{
X_1 \ar[d] \ar[r]_{f_1} & Y_1 \ar[d] \\
X_2 \ar[r]^{f_2} & Y_2
}
$$
be a commutative diagram of schemes. Let $Z_i \subset Y_i$, $i = 1, 2$ be
the scheme theoretic image of $f_i$. Then the morphism
$Y_1 \to Y_2$ induces a morphism $Z_1 \to Z_2$ and a
commutative diagram
$$
\xymatrix{
X_1 \ar[r] \ar[d] & Z_1 \ar[d] \ar[r] & Y_1 \ar[d] \\
X_2 \ar[r] & Z_2 \ar[r] & Y_2
}
$$
\end{lemma}

\begin{proof}
The scheme theoretic inverse image of $Z_2$ in $Y_1$
is a closed subscheme of $Y_1$ through
which $f_1$ factors. Hence $Z_1$ is contained in this.
This proves the lemma.
\end{proof}

\begin{lemma}
\label{lemma-scheme-theoretic-image-reduced}
Let $f : X \to Y$ be a morphism of schemes.
If $X$ is reduced, then the scheme theoretic image of $f$ is
the reduced induced scheme structure on $\overline{f(X)}$.
\end{lemma}

\begin{proof}
This is true because the reduced induced scheme structure on $\overline{f(X)}$
is clearly the smallest closed subscheme of $Y$ through which $f$ factors,
see
Schemes, Lemma \ref{schemes-lemma-map-into-reduction}.
\end{proof}

\begin{lemma}
\label{lemma-scheme-theoretic-image-of-partial-section}
Let $f : X \to Y$ be a separated morphism of schemes.
Let $V \subset Y$ be a retrocompact open. Let $s : V \to X$
be a morphism such that $f \circ s = \text{id}_V$.
Let $Y'$ be the scheme theoretic image of $s$.
Then $Y' \to Y$ is an isomorphism over $V$.
\end{lemma}

\begin{proof}
The assumption that $V$ is retrocompact in $Y$
(Topology, Definition \ref{topology-definition-quasi-compact})
means that $V \to Y$ is a quasi-compact morphism.
By Schemes, Lemma \ref{schemes-lemma-quasi-compact-permanence}
the morphism $s : V \to X$ is quasi-compact.
Hence the construction of the scheme theoretic image $Y'$
of $s$ commutes with restriction to opens by
Lemma \ref{lemma-quasi-compact-scheme-theoretic-image}.
In particular, we see that $Y' \cap f^{-1}(V)$ is the
scheme theoretic image of a section of the separated
morphism $f^{-1}(V) \to V$. Since a section of a separated
morphism is a closed immersion
(Schemes, Lemma \ref{schemes-lemma-section-immersion}),
we conclude that
$Y' \cap f^{-1}(V) \to V$ is an isomorphism as desired.
\end{proof}







\section{Scheme theoretic closure and density}
\label{section-scheme-theoretic-closure}

\noindent
We take the following definition from \cite[IV, Definition 11.10.2]{EGA}.

\begin{definition}
\label{definition-scheme-theoretically-dense}
Let $X$ be a scheme. Let $U \subset X$ be an open subscheme.
\begin{enumerate}
\item The scheme theoretic image of the morphism $U \to X$
is called the {\it scheme theoretic closure of $U$ in $X$}.
\item We say $U$ is {\it scheme theoretically dense in $X$}
if for every open $V \subset X$ the scheme theoretic closure
of $U \cap V$ in $V$ is equal to $V$.
\end{enumerate}
\end{definition}

\noindent
With this definition it is
{\bf not} the case that $U$ is scheme theoretically dense in $X$ if and
only if the scheme theoretic closure of $U$ is $X$, see
Example \ref{example-scheme-theretically-dense-not-dense}.
This is somewhat inelegant; but see
Lemmas \ref{lemma-scheme-theoretically-dense-quasi-compact} and
\ref{lemma-reduced-scheme-theoretically-dense}
below. On the other hand, with this definition $U$ is scheme theoretically
dense in $X$ if and only if for every $V \subset X$ open the ring map
$\mathcal{O}_X(V) \to \mathcal{O}_X(U \cap V)$ is injective, see
Lemma \ref{lemma-characterize-scheme-theoretically-dense}
below. In particular we see that scheme theoretically dense implies dense
which is pleasing.

\begin{example}
\label{example-scheme-theretically-dense-not-dense}
Here is an example where scheme theoretic closure being $X$ does not
imply dense for the underlying topological spaces.
Let $k$ be a field.
Set $A = k[x, z_1, z_2, \ldots]/(x^n z_n)$
Set $I = (z_1, z_2, \ldots) \subset A$.
Consider the affine scheme $X = \Spec(A)$ and the
open subscheme $U = X \setminus V(I)$.
Since $A \to \prod_n A_{z_n}$ is injective we see that the scheme theoretic
closure of $U$ is $X$. Consider the morphism
$X \to \Spec(k[x])$. This morphism is surjective
(set all $z_n = 0$ to see this). But the restriction
of this morphism to $U$ is not surjective because it maps
to the point $x = 0$. Hence $U$ cannot be topologically dense
in $X$.
\end{example}

\begin{lemma}
\label{lemma-scheme-theoretically-dense-quasi-compact}
Let $X$ be a scheme.
Let $U \subset X$ be an open subscheme.
If the inclusion morphism $U \to X$ is quasi-compact, then $U$
is scheme theoretically dense in $X$ if and only if the scheme theoretic
closure of $U$ in $X$ is $X$.
\end{lemma}

\begin{proof}
Follows from Lemma \ref{lemma-quasi-compact-scheme-theoretic-image} part (3).
\end{proof}

\begin{example}
\label{example-scheme-theoretic-closure}
Let $A$ be a ring and $X = \Spec(A)$.
Let $f_1, \ldots, f_n \in A$ and let $U = D(f_1) \cup \ldots \cup D(f_n)$.
Let $I = \Ker(A \to \prod A_{f_i})$.
Then the scheme theoretic closure of $U$ in $X$
is the closed subscheme $\Spec(A/I)$ of $X$.
Note that $U \to X$ is quasi-compact. Hence by
Lemma \ref{lemma-scheme-theoretically-dense-quasi-compact}
we see $U$ is scheme theoretically dense in $X$ if and only if $I = 0$.
\end{example}

\begin{lemma}
\label{lemma-characterize-scheme-theoretically-dense}
Let $j : U \to X$ be an open immersion of schemes.
Then $U$ is scheme theoretically dense in $X$ if and only if
$\mathcal{O}_X \to j_*\mathcal{O}_U$ is injective.
\end{lemma}

\begin{proof}
If $\mathcal{O}_X \to j_*\mathcal{O}_U$ is injective,
then the same is true when restricted to any open $V$ of $X$.
Hence the scheme theoretic closure of $U \cap V$ in $V$
is equal to $V$, see proof of Lemma \ref{lemma-scheme-theoretic-image}.
Conversely, suppose that the scheme theoretic
closure of $U \cap V$ is equal to $V$ for all opens $V$.
Suppose that $\mathcal{O}_X \to j_*\mathcal{O}_U$ is not injective.
Then we can find an affine open, say $\Spec(A) = V \subset X$
and a nonzero element $f \in A$ such that $f$ maps to zero in
$\Gamma(V \cap U, \mathcal{O}_X)$. In this case the scheme theoretic
closure of $V \cap U$ in $V$ is clearly contained in $\Spec(A/(f))$
a contradiction.
\end{proof}

\begin{lemma}
\label{lemma-intersection-scheme-theoretically-dense}
Let $X$ be a scheme. If $U$, $V$ are scheme theoretically dense
open subschemes of $X$, then so is $U \cap V$.
\end{lemma}

\begin{proof}
Let $W \subset X$ be any open.
Consider the map
$\mathcal{O}_X(W) \to \mathcal{O}_X(W \cap V)
\to \mathcal{O}_X(W \cap V \cap U)$.
By Lemma \ref{lemma-characterize-scheme-theoretically-dense}
both maps are injective. Hence the composite is injective.
Hence by Lemma \ref{lemma-characterize-scheme-theoretically-dense}
$U \cap V$ is scheme theoretically dense in $X$.
\end{proof}

\begin{lemma}
\label{lemma-quasi-compact-immersion}
Let $h : Z \to X$ be an immersion. Assume either $h$ is quasi-compact
or $Z$ is reduced. Let $\overline{Z} \subset X$ be the scheme theoretic
image of $h$. Then the morphism $Z \to \overline{Z}$ is an open immersion
which identifies $Z$ with a scheme theoretically dense open
subscheme of $\overline{Z}$. Moreover, $Z$ is topologically
dense in $\overline{Z}$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-factor-quasi-compact-immersion} or
Lemma \ref{lemma-factor-reduced-immersion} we can factor
$Z \to X$ as $Z \to \overline{Z}_1 \to X$ with $Z \to \overline{Z}_1$
open and $\overline{Z}_1 \to X$ closed. On the other hand, let
$Z \to \overline{Z} \subset X$ be the scheme theoretic image of
$Z \to X$. We conclude that $\overline{Z} \subset \overline{Z}_1$.
Since $Z$ is an open subscheme of $\overline{Z}_1$ it follows
that $Z$ is an open subscheme of $\overline{Z}$ as well.
In the case that $Z$ is reduced we know that $Z \subset \overline{Z}_1$
is topologically dense by the construction of $\overline{Z}_1$ in
the proof of Lemma \ref{lemma-factor-reduced-immersion}.
Hence $\overline{Z}_1$ and $\overline{Z}$ have the same
underlying topological spaces. Thus $\overline{Z} \subset \overline{Z}_1$
is a closed immersion into a reduced scheme which induces a bijection
on underlying topological spaces, and hence it is an isomorphism.
In the case that $Z \to X$ is quasi-compact we argue as follows:
The assertion that $Z$ is scheme theoretically dense in
$\overline{Z}$ follows from
Lemma \ref{lemma-quasi-compact-scheme-theoretic-image} part (3).
The last assertion follows from
Lemma \ref{lemma-quasi-compact-scheme-theoretic-image} part (4).
\end{proof}

\begin{lemma}
\label{lemma-reduced-scheme-theoretically-dense}
Let $X$ be a reduced scheme and let $U \subset X$ be an open subscheme.
Then the following are equivalent
\begin{enumerate}
\item $U$ is topologically dense in $X$,
\item the scheme theoretic closure of $U$ in $X$ is $X$, and
\item $U$ is scheme theoretically dense in $X$.
\end{enumerate}
\end{lemma}

\begin{proof}
This follows from
Lemma \ref{lemma-quasi-compact-immersion}
and the fact that a closed subscheme $Z$ of $X$ whose
underlying topological space equals $X$ must be equal to $X$
as a scheme.
\end{proof}

\begin{lemma}
\label{lemma-reduced-subscheme-closure}
Let $X$ be a scheme and let $U \subset X$ be a reduced open subscheme.
Then the following are equivalent
\begin{enumerate}
\item the scheme theoretic closure of $U$ in $X$ is $X$, and
\item $U$ is scheme theoretically dense in $X$.
\end{enumerate}
If this holds then $X$ is a reduced scheme.
\end{lemma}

\begin{proof}
This follows from
Lemma \ref{lemma-quasi-compact-immersion}
and the fact that the scheme theoretic closure of $U$ in $X$ is
reduced by
Lemma \ref{lemma-scheme-theoretic-image-reduced}.
\end{proof}


\begin{lemma}
\label{lemma-equality-of-morphisms}
Let $S$ be a scheme. Let $X$, $Y$ be schemes over $S$.
Let $f, g : X \to Y$ be morphisms of schemes over $S$.
Let $U \subset X$ be an open subscheme such that
$f|_U = g|_U$. If the scheme theoretic closure of $U$
in $X$ is $X$ and $Y \to S$ is separated, then $f = g$.
\end{lemma}

\begin{proof}
Follows from the definitions and
Schemes, Lemma \ref{schemes-lemma-where-are-they-equal}.
\end{proof}




\section{Dominant morphisms}
\label{section-dominant}

\noindent
The definition of a morphism of schemes being dominant is a little
different from what you might expect if you are used to the notion
of a dominant morphism of varieties.

\begin{definition}
\label{definition-dominant}
A morphism $f : X \to S$ of schemes is called {\it dominant} if the
image of $f$ is a dense subset of $S$.
\end{definition}

\noindent
So for example, if $k$ is an infinite field and $\lambda_1, \lambda_2, \ldots$
is a countable collection of distinct elements of $k$, then the morphism
$$
\coprod\nolimits_{i = 1, 2, \ldots } \Spec(k)
\longrightarrow
\Spec(k[x])
$$
with $i$th factor mapping to the point $x = \lambda_i$ is dominant.

\begin{lemma}
\label{lemma-generic-points-in-image-dominant}
Let $f : X \to S$ be a morphism of schemes.
If every generic point of every irreducible component of $S$
is in the image of $f$, then $f$ is dominant.
\end{lemma}

\begin{proof}
This is a topological fact which follows directly from the fact that
the topological space underlying a scheme is sober, see
Schemes, Lemma \ref{schemes-lemma-scheme-sober}, and that
every point of $S$ is contained in an irreducible component of
$S$, see Topology, Lemma \ref{topology-lemma-irreducible}.
\end{proof}

\noindent
The expectation that morphisms are dominant only if generic points of the
target are in the image does hold if the morphism is quasi-compact.

\begin{lemma}
\label{lemma-quasi-compact-dominant}
\begin{slogan}
Morphisms whose image contains the generic points are dominant
\end{slogan}
Let $f : X \to S$ be a quasi-compact morphism of schemes.
Then $f$ is dominant if and only if for every irreducible
component $Z \subset S$ the generic point of $Z$ is in the
image of $f$.
\end{lemma}

\begin{proof}
Let $V \subset S$ be an affine open.
Because $f$ is quasi-compact we may choose finitely many affine
opens $U_i \subset f^{-1}(V)$, $i = 1, \ldots, n$ covering
$f^{-1}(V)$. Consider the morphism of affines
$$
f' :
\coprod\nolimits_{i = 1, \ldots, n} U_i
\longrightarrow
V.
$$
A disjoint union of affines is affine, see
Schemes, Lemma \ref{schemes-lemma-disjoint-union-affines}.
Generic points of irreducible components of $V$
are exactly the generic points of the irreducible components of
$S$ that meet $V$. Also, $f$ is dominant if and only if $f'$ is dominant
no matter what choices of $V, n, U_i$ we make above. Thus we
have reduced the lemma to the case of a morphism of affine schemes.
The affine case is
Algebra, Lemma \ref{algebra-lemma-image-dense-generic-points}.
\end{proof}

\begin{lemma}
\label{lemma-base-change-dominant}
Let $f : X \to S$ be a quasi-compact dominant morphism of schemes.
Let $g : S' \to S$ be a morphism of schemes,  and let $f' : X' \to S'$
be the base change of $f$ by $g$. If generalizations lift along $g$,
then $f'$ is dominant.
\end{lemma}

\noindent
We will see that generalizations lift along $g$ if $g$ is open
(Lemma \ref{lemma-open-generizing})
or flat (Lemma \ref{lemma-generalizations-lift-flat}).

\begin{proof}
Observe that $f'$ is quasi-compact by Schemes, Lemma
\ref{schemes-lemma-quasi-compact-preserved-base-change}.
Let $\eta' \in S'$ be the generic point of an irreducible
component of $S'$. If generalizations lift along $g$,
then $\eta = g(\eta')$ is the generic point of an irreducible
component of $S$. By Lemma \ref{lemma-quasi-compact-dominant}
we see that $\eta$ is in the image of $f$.
Hence $\eta'$ is in the image of $f'$ by
Schemes, Lemma \ref{schemes-lemma-points-fibre-product}.
It follows that $f'$ is dominant by Lemma \ref{lemma-quasi-compact-dominant}.
\end{proof}

\noindent
Part of this holds for arbitrary (not necessarily quasi-compact)
dominant morphisms.

\begin{lemma}
\label{lemma-open-base-change-dominant}
Let $f : X \to S$ be a dominant morphism of schemes.
Let $g : S' \to S$ be an open morphism of schemes, and let $f' : X' \to S'$
be the base change of $f$ by $g$. Then $f'$ is dominant.
\end{lemma}

\begin{proof}
If $f'$ is not dominant, then $f'(X')$ is contained in some closed
subset $B$ not equal to $S'$. Then $S'-B$ is open in $S'$ and nonempty.
Since $g$ is open, $g(S'-B)$ is nonempty and open in $S$. Since $f(X)$
is dense in $S$, there is a point $x\in X$ with $f(x) \in g(S'-B)$.
Let $W = \Spec(\kappa (f(x)))$,
and write $X_W$, $S_W$, $S'_W$ for the pullbacks
of these schemes from $S$ to $W$. Then $X_W$ and $(S'-B)_W$ are nonempty,
and so $X_W \times_W (S'-B)_W$ is nonempty, as $W$ is the spectrum
of a field. This contradicts that $f'(X \times_S S')$ is contained
in $B \subset S'$. So in fact $f'$ is dominant.
\end{proof}

\begin{lemma}
\label{lemma-quasi-compact-generic-point-not-in-image}
Let $f : X \to S$ be a quasi-compact morphism of schemes.
Let $\eta \in S$ be a generic point of an irreducible
component of $S$. If $\eta \not \in f(X)$ then there
exists an open neighbourhood $V \subset S$ of $\eta$
such that $f^{-1}(V) = \emptyset$.
\end{lemma}

\begin{proof}
Let $Z \subset S$ be the scheme theoretic image of $f$.
We have to show that $\eta \not \in Z$.
This follows from
Lemma \ref{lemma-reach-points-scheme-theoretic-image}
but can also be seen as follows.
By Lemma \ref{lemma-quasi-compact-scheme-theoretic-image}
the morphism $X \to Z$ is dominant, which by
Lemma \ref{lemma-quasi-compact-dominant}
means all the generic points of all irreducible components of $Z$
are in the image of $X \to Z$. By assumption we see that
$\eta \not \in Z$ since $\eta$ would be the generic
point of some irreducible component of $Z$ if it were in $Z$.
\end{proof}

\noindent
There is another case where dominant is the same as having all
generic points of irreducible components in the image.

\begin{lemma}
\label{lemma-dominant-finite-number-irreducible-components}
Let $f : X \to S$ be a morphism of schemes.
Suppose that $X$ has finitely many irreducible components.
Then $f$ is dominant (if and) only if for every irreducible
component $Z \subset S$ the generic point of $Z$ is in the
image of $f$. If so, then $S$ has finitely many irreducible
components as well.
\end{lemma}

\begin{proof}
Assume $f$ is dominant.
Say $X = Z_1 \cup Z_2 \cup \ldots \cup Z_n$ is the decomposition
of $X$ into irreducible components. Let $\xi_i \in Z_i$ be
its generic point, so $Z_i = \overline{\{\xi_i\}}$.
Note that $f(Z_i)$ is an irreducible subset of $S$.
Hence
$$
S = \overline{f(X)} = \bigcup \overline{f(Z_i)} =
\bigcup \overline{\{f(\xi_i)\}}
$$
is a finite union of irreducible subsets whose generic
points are in the image of $f$. The lemma follows.
\end{proof}

\begin{lemma}
\label{lemma-dominant-between-integral}
Let $f : X \to Y$ be a morphism of integral schemes. The following
are equivalent
\begin{enumerate}
\item $f$ is dominant,
\item $f$ maps the generic point of $X$ to the generic point of $Y$,
\item for some nonempty affine opens $U \subset X$ and $V \subset Y$
with $f(U) \subset V$ the ring map $\mathcal{O}_Y(V) \to \mathcal{O}_X(U)$
is injective,
\item for all nonempty affine opens $U \subset X$ and $V \subset Y$
with $f(U) \subset V$ the ring map $\mathcal{O}_Y(V) \to \mathcal{O}_X(U)$
is injective,
\item for some $x \in X$ with image $y = f(x) \in Y$ the local ring
map $\mathcal{O}_{Y, y} \to \mathcal{O}_{X, x}$ is injective, and
\item for all $x \in X$ with image $y = f(x) \in Y$ the local ring
map $\mathcal{O}_{Y, y} \to \mathcal{O}_{X, x}$ is injective.
\end{enumerate}
\end{lemma}

\begin{proof}
The equivalence of (1) and (2) follows from
Lemma \ref{lemma-dominant-finite-number-irreducible-components}.
Let $U \subset X$ and $V \subset Y$ be nonempty affine opens with
$f(U) \subset V$. Recall that the rings $A = \mathcal{O}_X(U)$
and $B = \mathcal{O}_Y(V)$ are integral domains.
The morphism $f|_U : U \to V$ corresponds to a ring map
$\varphi : B \to A$. The generic points of $X$ and $Y$ correspond
to the prime ideals $(0) \subset A$ and $(0) \subset B$. Thus
(2) is equivalent to the condition $(0) = \varphi^{-1}((0))$,
i.e., to the condition that $\varphi$ is injective.
In this way we see that (2), (3), and (4) are equivalent.
Similarly, given $x$ and $y$ as in (5) the local rings
$\mathcal{O}_{X, x}$ and $\mathcal{O}_{Y, y}$ are domains
and the prime ideals $(0) \subset \mathcal{O}_{X, x}$
and $(0) \subset \mathcal{O}_{Y, y}$ correspond to the
generic points of $X$ and $Y$ (via the identification of
the spectrum of the local ring at $x$
with the set of points specializing to $x$, see
Schemes, Lemma \ref{schemes-lemma-specialize-points}).
Thus we can argue in the exact same manner as above
to see that (2), (5), and (6) are equivalent.
\end{proof}







\section{Surjective morphisms}
\label{section-surjective}

\begin{definition}
\label{definition-surjective}
A morphism of schemes is said to be {\it surjective}
if it is surjective on underlying topological
spaces.
\end{definition}

\begin{lemma}
\label{lemma-composition-surjective}
The composition of surjective morphisms is surjective.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-when-point-maps-to-pair}
Let $X$ and $Y$ be schemes over a base scheme $S$. Given points $x \in X$ and
$y \in Y$, there is a point of $X \times_S Y$ mapping to $x$ and $y$ under the
projections if and only if $x$ and $y$ lie above the same point of $S$.
\end{lemma}

\begin{proof}
The condition is obviously necessary, and the converse follows from the proof
of Schemes, Lemma \ref{schemes-lemma-points-fibre-product}.
\end{proof}

\begin{lemma}
\label{lemma-base-change-surjective}
The base change of a surjective morphism is surjective.
\end{lemma}

\begin{proof}
Let $f: X \to Y$ be a morphism of schemes over a base scheme $S$.
If $S' \to S$ is a morphism of schemes, let $p: X_{S'} \to X$
and $q: Y_{S'} \to Y$ be the canonical projections.  The commutative
square
$$
\xymatrix{
X_{S'} \ar[d]_{f_{S'}} \ar[r]_p & X \ar[d]^{f} \\
Y_{S'} \ar[r]^{q} & Y.
}
$$
identifies $X_{S'}$ as a fibre product of $X \to Y$ and
$Y_{S'} \to Y$.  Let $Z$ be a subset of the underlying topological
space of $X$.  Then $q^{-1}(f(Z)) = f_{S'}(p^{-1}(Z))$, because
$y' \in q^{-1}(f(Z))$ if and only if $q(y') = f(x)$ for some $x \in Z$,
if and only if, by Lemma \ref{lemma-when-point-maps-to-pair}, there exists
$x' \in X_{S'}$ such that $f_{S'}(x') = y'$ and $p(x') = x$.  In particular
taking $Z = X$ we see that if $f$ is surjective so is the base change
$f_{S'}: X_{S'} \to Y_{S'}$.
\end{proof}

\begin{example}
\label{example-injective-not-preserved-base-change}
Bijectivity is not stable under base change, and so neither is injectivity.
For example consider the bijection
$\Spec(\mathbf{C}) \to \Spec(\mathbf{R})$.
The base change
$\Spec(\mathbf{C} \otimes_{\mathbf{R}} \mathbf{C}) \to
\Spec(\mathbf{C})$
is not injective, since there is an isomorphism
$\mathbf{C} \otimes_{\mathbf{R}} \mathbf{C} \cong \mathbf{C} \times \mathbf{C}$
(the decomposition comes from the idempotent
$\frac{1 \otimes 1 + i \otimes i}{2}$) and hence
$\Spec(\mathbf{C} \otimes_{\mathbf{R}} \mathbf{C})$ has two points.
\end{example}

\begin{lemma}
\label{lemma-surjection-from-quasi-compact}
Let
$$
\xymatrix{
X \ar[rr]_f \ar[rd]_p & &
Y \ar[dl]^q \\
& Z
}
$$
be a commutative diagram of morphisms of schemes.
If $f$ is surjective and $p$ is quasi-compact, then $q$ is quasi-compact.
\end{lemma}

\begin{proof}
Let $W \subset Z$ be a quasi-compact open. By assumption $p^{-1}(W)$
is quasi-compact. Hence by
Topology, Lemma \ref{topology-lemma-image-quasi-compact}
the inverse image $q^{-1}(W) = f(p^{-1}(W))$ is quasi-compact too.
This proves the lemma.
\end{proof}




\section{Radicial and universally injective morphisms}
\label{section-radicial}

\noindent
In this section we define what it means for a morphism of schemes to
be {\it radicial} and what it means for a morphism of schemes to be
{\it universally injective}. We then show that these notions agree.
The reason for introducing both is that in the case of algebraic spaces
there are corresponding notions which may not always agree.

\begin{definition}
\label{definition-universally-injective}
Let $f : X \to S$ be a morphism.
\begin{enumerate}
\item We say that $f$ is {\it universally injective} if and only
if for any morphism of schemes $S' \to S$ the base change
$f' : X_{S'} \to S'$ is injective (on underlying topological spaces).
\item We say $f$ is {\it radicial} if $f$ is injective as a
map of topological spaces, and for every $x \in X$ the field
extension $\kappa(x)/\kappa(f(x))$ is purely inseparable.
\end{enumerate}
\end{definition}

\begin{lemma}
\label{lemma-universally-injective}
Let $f : X \to S$ be a morphism of schemes.
The following are equivalent:
\begin{enumerate}
\item For every field $K$ the induced map
$\Mor(\Spec(K), X) \to \Mor(\Spec(K), S)$
is injective.
\item The morphism $f$ is universally injective.
\item The morphism $f$ is radicial.
\item The diagonal morphism $\Delta_{X/S} : X \longrightarrow X \times_S X$
is surjective.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $K$ be a field, and let $s : \Spec(K) \to S$ be a morphism.
Giving a morphism $x : \Spec(K) \to X$ such that $f \circ x = s$
is the same as giving a section of the projection
$X_K = \Spec(K) \times_S X \to \Spec(K)$, which in turn
is the same as giving a point $x \in X_K$ whose residue field is $K$.
Hence we see that (2) implies (1).

\medskip\noindent
Conversely, suppose that (1) holds. Assume that $x, x' \in X_{S'}$
map to the same point $s' \in S'$. Choose a commutative diagram
$$
\xymatrix{
K & \kappa(x) \ar[l] \\
\kappa(x') \ar[u] & \kappa(s') \ar[l] \ar[u]
}
$$
of fields. By Schemes, Lemma \ref{schemes-lemma-characterize-points}
we get two morphisms $a, a' : \Spec(K) \to X_{S'}$. One corresponding
to the point $x$ and the embedding $\kappa(x) \subset K$ and
the other corresponding to the  point $x'$ and the embedding
$\kappa(x') \subset K$. Also we have $f' \circ a = f' \circ a'$.
Condition (1) now implies that the compositions of $a$ and $a'$ with
$X_{S'} \to X$ are equal. Since $X_{S'}$ is the fibre product
of $S'$ and $X$ over $S$ we see that $a = a'$. Hence $x = x'$.
Thus (1) implies (2).

\medskip\noindent
If there are two different points $x, x' \in X$ mapping to the same point of $s$
then (2) is violated.
If for some $s = f(x)$, $x \in X$ the field extension
$\kappa(x)/\kappa(s)$ is not purely inseparable, then
we may find a field extension $K/\kappa(s)$ such that
$\kappa(x)$ has two $\kappa(s)$-homomorphisms into $K$. By
Schemes, Lemma \ref{schemes-lemma-characterize-points} this
implies that the map
$\Mor(\Spec(K), X) \to \Mor(\Spec(K), S)$
is not injective, and hence (1) is violated.
Thus we see that the equivalent conditions (1) and (2) imply
$f$ is radicial, i.e., they imply (3).

\medskip\noindent
Assume (3). By
Schemes, Lemma \ref{schemes-lemma-characterize-points}
a morphism $\Spec(K) \to X$ is given by a pair $(x, \kappa(x) \to K)$.
Property (3) says exactly that associating to the pair
$(x, \kappa(x) \to K)$ the pair $(s, \kappa(s) \to \kappa(x) \to K)$
is injective. In other words (1) holds. At this point we know that
(1), (2) and (3) are all equivalent.

\medskip\noindent
Finally, we prove the equivalence of (4) with (1), (2) and (3).
A point of $X \times_S X$ is given by a quadruple
$(x_1, x_2, s, \mathfrak p)$, where $x_1, x_2 \in X$,
$f(x_1) = f(x_2) = s$ and
$\mathfrak p \subset \kappa(x_1) \otimes_{\kappa(s)} \kappa(x_2)$
is a prime ideal, see
Schemes, Lemma \ref{schemes-lemma-points-fibre-product}.
If $f$ is universally injective, then
by taking $S'=X$ in the definition of universally injective,
$\Delta_{X/S}$ must be surjective since it is a section of
the injective morphism
$X \times_S X  \longrightarrow X$.
Conversely, if
$\Delta_{X/S}$ is surjective, then always $x_1 = x_2 = x$ and there
is exactly one such prime ideal $\mathfrak p$, which means that
$\kappa(s) \subset \kappa(x)$ is purely inseparable.
Hence $f$ is radicial.
Alternatively, if $\Delta_{X/S}$ is surjective,
then for any $S' \to S$ the base
change $\Delta_{X_{S'}/S'}$ is surjective which implies that $f$
is universally injective. This finishes the proof of the lemma.
\end{proof}

\begin{lemma}
\label{lemma-universally-injective-separated}
A universally injective morphism is separated.
\end{lemma}

\begin{proof}
Combine
Lemma \ref{lemma-universally-injective}
with the remark that $X \to S$ is separated if and only if the image
of $\Delta_{X/S}$ is closed in $X \times_S X$, see
Schemes, Definition \ref{schemes-definition-separated}
and the discussion following it.
\end{proof}

\begin{lemma}
\label{lemma-base-change-universally-injective}
A base change of a universally injective morphism is universally injective.
\end{lemma}

\begin{proof}
This is formal.
\end{proof}

\begin{lemma}
\label{lemma-composition-universally-injective}
A composition of radicial morphisms is radicial, and so the same holds
for the equivalent condition of being universally injective.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}









\section{Affine morphisms}
\label{section-affine}

\begin{definition}
\label{definition-affine}
A morphism of schemes $f : X \to S$ is called {\it affine} if
the inverse image of every affine open of $S$ is an affine
open of $X$.
\end{definition}

\begin{lemma}
\label{lemma-affine-separated}
An affine morphism is separated and quasi-compact.
\end{lemma}

\begin{proof}
Let $f : X \to S$ be affine. Quasi-compactness is immediate from
Schemes, Lemma \ref{schemes-lemma-quasi-compact-affine}.
We will show $f$ is separated using
Schemes, Lemma \ref{schemes-lemma-characterize-separated}. Let
$x_1, x_2 \in X$ be points of $X$ which map to the same point $s \in S$.
Choose any affine open $W \subset S$ containing $s$. By assumption
$f^{-1}(W)$ is affine. Apply the lemma cited with $U = V = f^{-1}(W)$.
\end{proof}

\begin{lemma}
\label{lemma-characterize-affine}
\begin{reference}
\cite[II, Corollary 1.3.2]{EGA}
\end{reference}
Let $f : X \to S$ be a morphism of schemes.
The following are equivalent
\begin{enumerate}
\item The morphism $f$ is affine.
\item There exists an affine open covering $S = \bigcup W_j$
such that each $f^{-1}(W_j)$ is affine.
\item There exists a quasi-coherent sheaf of $\mathcal{O}_S$-algebras
$\mathcal{A}$ and an isomorphism
$X \cong \underline{\Spec}_S(\mathcal{A})$
of schemes over $S$. See
Constructions, Section \ref{constructions-section-spec} for notation.
\end{enumerate}
Moreover, in this case $X = \underline{\Spec}_S(f_*\mathcal{O}_X)$.
\end{lemma}

\begin{proof}
It is obvious that (1) implies (2).

\medskip\noindent
Assume $S = \bigcup_{j \in J} W_j$ is an affine open covering such that
each $f^{-1}(W_j)$ is affine. By
Schemes, Lemma \ref{schemes-lemma-quasi-compact-affine} we see
that $f$ is quasi-compact. By
Schemes, Lemma \ref{schemes-lemma-characterize-quasi-separated}
we see the morphism $f$ is quasi-separated. Hence by
Schemes, Lemma \ref{schemes-lemma-push-forward-quasi-coherent} the
sheaf $\mathcal{A} = f_*\mathcal{O}_X$ is a quasi-coherent sheaf
of $\mathcal{O}_S$-algebras. Thus we have the scheme
$g : Y = \underline{\Spec}_S(\mathcal{A}) \to S$ over $S$.
The identity map
$\text{id} : \mathcal{A} = f_*\mathcal{O}_X \to f_*\mathcal{O}_X$
provides, via the definition of the relative spectrum,
a morphism $can : X \to Y$ over $S$, see
Constructions, Lemma \ref{constructions-lemma-canonical-morphism}.
By assumption and the lemma just cited
the restriction $can|_{f^{-1}(W_j)} : f^{-1}(W_j) \to g^{-1}(W_j)$
is an isomorphism. Thus $can$ is an isomorphism.
We have shown that (2) implies (3).

\medskip\noindent
Assume (3). By Constructions, Lemma \ref{constructions-lemma-spec-properties}
we see that the inverse image of every affine open is affine, and hence
the morphism is affine by definition.
\end{proof}

\begin{remark}
\label{remark-direct-argument}
We can also argue directly that (2) implies (1) in
Lemma \ref{lemma-characterize-affine} above as follows.
Assume $S = \bigcup W_j$ is an affine open covering
such that each $f^{-1}(W_j)$ is affine.
First argue that $\mathcal{A} = f_*\mathcal{O}_X$ is quasi-coherent
as in the proof above.
Let $\Spec(R) = V \subset S$ be affine open.
We have to show that $f^{-1}(V)$ is affine. Set
$A = \mathcal{A}(V) = f_*\mathcal{O}_X(V) = \mathcal{O}_X(f^{-1}(V))$.
By Schemes, Lemma \ref{schemes-lemma-morphism-into-affine} there is
a canonical morphism $\psi : f^{-1}(V) \to \Spec(A)$ over
$\Spec(R) = V$.
By Schemes, Lemma \ref{schemes-lemma-good-subcover} there exists
an integer $n \geq 0$, a standard open covering
$V = \bigcup_{i = 1, \ldots, n} D(h_i)$, $h_i \in R$, and a map
$a : \{1, \ldots, n\} \to J$ such that each $D(h_i)$ is also
a standard open of the affine scheme $W_{a(i)}$. The inverse image
of a standard open under a morphism of affine schemes is standard open, see
Algebra, Lemma \ref{algebra-lemma-spec-functorial}. Hence we see
that $f^{-1}(D(h_i))$ is a standard open of $f^{-1}(W_{a(i)})$,
in particular that $f^{-1}(D(h_i))$ is affine. Because $\mathcal{A}$
is quasi-coherent we have
$A_{h_i} = \mathcal{A}(D(h_i)) = \mathcal{O}_X(f^{-1}(D(h_i)))$,
so $f^{-1}(D(h_i))$ is the spectrum of $A_{h_i}$.
It follows that the morphism $\psi$ induces an isomorphism of the open
$f^{-1}(D(h_i))$ with the open $\Spec(A_{h_i})$ of
$\Spec(A)$. Since $f^{-1}(V) = \bigcup f^{-1}(D(h_i))$
and $\Spec(A) = \bigcup \Spec(A_{h_i})$ we win.
\end{remark}

\begin{lemma}
\label{lemma-affine-equivalence-algebras}
Let $S$ be a scheme. There is an anti-equivalence of categories
$$
\begin{matrix}
\text{Schemes affine} \\
\text{over }S
\end{matrix}
\longleftrightarrow
\begin{matrix}
\text{quasi-coherent sheaves} \\
\text{of }\mathcal{O}_S\text{-algebras}
\end{matrix}
$$
which associates to $f : X \to S$ the sheaf $f_*\mathcal{O}_X$.
Moreover, this equivalence is compatible with arbitrary base change.
\end{lemma}

\begin{proof}
The functor from right to left is given by $\underline{\Spec}_S$.
The two functors are mutually inverse by
Lemma \ref{lemma-characterize-affine} and
Constructions, Lemma \ref{constructions-lemma-spec-properties} part (3).
The final statement is
Constructions, Lemma \ref{constructions-lemma-spec-properties} part (2).
\end{proof}

\begin{lemma}
\label{lemma-quasi-coherence-scalar-restriction}
Let $S$ be a scheme and let $\mathcal{A}$ be a quasi-coherent
$\mathcal{O}_S$-algebra. An $\mathcal{A}$-module is
quasi-coherent as an $\mathcal{O}_S$-module if and only if
it is quasi-coherent as an $\mathcal{A}$-module.
\end{lemma}

\begin{proof}
Let $\mathcal{F}$ be an $\mathcal{A}$-module.
If $\mathcal{F}$ is quasi-coherent as an $\mathcal{A}$-module, then
for every $s \in S$ there exists an open neighbourhood $U$ of $s$
and an exact sequence
$$
\bigoplus\nolimits_J\mathcal{A}|_U\to
\bigoplus\nolimits_I\mathcal{A}|_U\to
\mathcal{F}|_U
$$
of $\mathcal{A}|_U$-modules.
Then this is also an exact sequence of $\mathcal{O}_U$-modules.
Hence $\mathcal{F}|_U$ is quasi-coherent as the cokernel of a morphism
of quasi-coherent $\mathcal{O}_U$-modules on a scheme. It follows
that $\mathcal{F}$ is quasi-coherent as an $\mathcal{O}_X$-module.

\medskip\noindent
Conversely, assume $\mathcal{F}$ is quasi-coherent as an $\mathcal{O}_X$-module.
Pick an open affine $\Spec(R) = U \subset S$. We have isomorphisms of
$\mathcal{O}_U$-modules $\mathcal{A}|_U \cong \widetilde{A}$ and
$\mathcal{F}|_U \cong \widetilde{M}$, for some $R$-algebra $A$
and some $R$-module $M$. The $\mathcal{A}$-module structure on $\mathcal{F}$
translates into an $A$-module structure on $M$ compatible with the
given $R$-module structure (details omitted). Choose an exact sequence
$$
\bigoplus\nolimits_J A \to
\bigoplus\nolimits_I A \to
M \to 0
$$
of $A$-modules. Since the functor $\widetilde{\ }$ is exact, this
produces an exact sequence
$$
\bigoplus\nolimits_J \widetilde{A}\to
\bigoplus\nolimits_I \widetilde{A}\to
\widetilde{M} \to 0
$$
of $\widetilde{A}$-modules. This means that
$\mathcal{F}$ is quasi-coherent as an $\mathcal{A}$-module.
\end{proof}

\begin{lemma}
\label{lemma-affine-equivalence-modules}
Let $f : X \to S$ be an affine morphism of schemes.
Let $\mathcal{A} = f_*\mathcal{O}_X$.
The functor $\mathcal{F} \mapsto f_*\mathcal{F}$ induces
an equivalence of categories
$$
\left\{
\begin{matrix}
\text{category of quasi-coherent}\\
\mathcal{O}_X\text{-modules}
\end{matrix}
\right\}
\longrightarrow
\left\{
\begin{matrix}
\text{category of quasi-coherent}\\
\mathcal{A}\text{-modules}
\end{matrix}
\right\}
$$
Moreover, an $\mathcal{A}$-module is
quasi-coherent as an $\mathcal{O}_S$-module if and only if
it is quasi-coherent as an $\mathcal{A}$-module.
\end{lemma}

\begin{proof}
The final statement is Lemma \ref{lemma-quasi-coherence-scalar-restriction}.
By Lemma \ref{lemma-affine-separated} and
Schemes, Lemma \ref{schemes-lemma-push-forward-quasi-coherent}
the pushforward $f_*\mathcal{F}$ of a quasi-coherent $\mathcal{O}_X$-module
$\mathcal{F}$
is a quasi-coherent $\mathcal{O}_S$-module. Hence a functor as in
the statement of the lemma.

\medskip\noindent
We will construct an quasi-inverse $h$ to this functor. Let $\mathcal{G}$
be a quasi-coherent $\mathcal{A}$-module. Then we set
$$
h(\mathcal{G}) = f^*\mathcal{G} \otimes_{f^*\mathcal{A}} \mathcal{O}_X =
f^*\mathcal{G} \otimes_{f^*f_*\mathcal{O}_X} \mathcal{O}_X
$$
Elucidation: the pullback $f^*\mathcal{A} = f^*f_*\mathcal{O}_X$
is an $\mathcal{O}_X$-algebra, the adjunction map
$f^*f_*\mathcal{O}_X \to \mathcal{O}_X$ is an algebra homomorphism, and
the pullback $f^*\mathcal{G}$ is an $f^*\mathcal{A}$-module. Observe that
$h(\mathcal{G})$ is quasi-coherent as quasi-coherence is preserved by
pullbacks and change of rings. Observe that there is a functorial map
$$
h(f_*\mathcal{F}) =
f^*f_*\mathcal{F} \otimes_{f^*f_*\mathcal{O}_X} \mathcal{O}_X \to \mathcal{F}
$$
coming from the adjunction map $f^*f_*\mathcal{F} \to \mathcal{F}$ and
a functorial map
$$
\mathcal{G} \to f_*h(\mathcal{G}) \quad\text{adjoint to the map}\quad
f^*\mathcal{G} \to f^*\mathcal{G} \otimes_{f^*f_*\mathcal{O}_X} \mathcal{O}_X
$$
which sends a local section $s$ of $f^*\mathcal{F}$ to $s \otimes 1$.
To finish the proof it suffices to show that these maps are isomorphisms
for $\mathcal{F}$ and $\mathcal{G}$ as above. This may be checked on the
members of an affine covering, i.e., when $X$ and $S$ are affine.

\medskip\noindent
The key algebra observation which makes this work is the
following: Let $R \to A$ be a ring map. Let $N$ be an $A$-module. Then
$$
(N \otimes_R A) \otimes_{(A \otimes_R A)} A = N
$$
Namely, the left hand side of this equality is the effect of applying
$h$ to the quasi-coherent $\widetilde{A}$-module $\widetilde{N}$ on $\Spec(R)$.
We omit the details.
\end{proof}

\begin{lemma}
\label{lemma-composition-affine}
The composition of affine morphisms is affine.
\end{lemma}

\begin{proof}
Let $f : X \to Y$ and $g : Y \to Z$ be affine morphisms.
Let $U \subset Z$ be affine open. Then $g^{-1}(U)$ is affine
by assumption on $g$. Whereupon $f^{-1}(g^{-1}(U))$ is affine
by assumption on $f$. Hence $(g \circ f)^{-1}(U)$ is affine.
\end{proof}

\begin{lemma}
\label{lemma-base-change-affine}
The base change of an affine morphism is affine.
\end{lemma}

\begin{proof}
Let $f : X \to S$ be an affine morphism. Let $S' \to S$ be any morphism.
Denote $f' : X_{S'} = S' \times_S X \to S'$ the base change of $f$.
For every $s' \in S'$ there exists an open affine neighbourhood
$s' \in V \subset S'$ which maps into some open affine $U \subset S$.
By assumption $f^{-1}(U)$ is affine. By the material in
Schemes, Section \ref{schemes-section-fibre-products} we see
that $f^{-1}(U)_V = V \times_U f^{-1}(U)$ is affine and equal
to $(f')^{-1}(V)$. This proves that $S'$ has an open covering by
affines whose inverse image under $f'$ is affine. We conclude
by Lemma \ref{lemma-characterize-affine} above.
\end{proof}

\begin{lemma}
\label{lemma-closed-immersion-affine}
A closed immersion is affine.
\end{lemma}

\begin{proof}
The first indication of this is
Schemes, Lemma \ref{schemes-lemma-closed-immersion-affine-case}.
See Schemes, Lemma \ref{schemes-lemma-closed-subspace-scheme}
for a complete statement.
\end{proof}

\begin{lemma}
\label{lemma-affine-s-open}
Let $X$ be a scheme.
Let $\mathcal{L}$ be an invertible $\mathcal{O}_X$-module.
Let $s \in \Gamma(X, \mathcal{L})$.
The inclusion morphism $j : X_s \to X$ is affine.
\end{lemma}

\begin{proof}
This follows from Properties, Lemma \ref{properties-lemma-affine-cap-s-open}
and the definition.
\end{proof}

\begin{lemma}
\label{lemma-affine-permanence}
Suppose $g : X \to Y$ is a morphism of schemes over $S$.
\begin{enumerate}
\item If $X$ is affine over $S$ and $\Delta : Y \to Y \times_S Y$ is affine,
then $g$ is affine.
\item If $X$ is affine over $S$ and $Y$ is separated over $S$,
then $g$ is affine.
\item A morphism from an affine scheme to a scheme with affine
diagonal is affine.
\item A morphism from an affine scheme to a separated scheme is affine.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). The base change $X \times_S Y \to Y$ is affine by
Lemma \ref{lemma-base-change-affine}.
The morphism $(1, g) : X \to X \times_S Y$ is the base change of
$Y \to Y \times_S Y$ by the morphism $X \times_S Y \to Y \times_S Y$.
Hence it is affine by
Lemma \ref{lemma-base-change-affine}.
The composition of affine morphisms is affine
(see Lemma \ref{lemma-composition-affine}) and (1) follows.
Part (2) follows from (1) as a closed immersion is affine
(see Lemma \ref{lemma-closed-immersion-affine}) and $Y/S$ separated
means $\Delta$ is a closed immersion. Parts (3) and (4) are special
cases of (1) and (2).
\end{proof}

\begin{lemma}
\label{lemma-morphism-affines-affine}
A morphism between affine schemes is affine.
\end{lemma}

\begin{proof}
Immediate from Lemma \ref{lemma-affine-permanence} with
$S = \Spec(\mathbf{Z})$. It also follows directly from the
equivalence of (1) and (2) in Lemma \ref{lemma-characterize-affine}.
\end{proof}

\begin{lemma}
\label{lemma-Artinian-affine}
Let $S$ be a scheme.
Let $A$ be an Artinian ring.
Any morphism $\Spec(A) \to S$ is affine.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-get-affine}
Let $j : Y \to X$ be an immersion of schemes.
Assume there exists an open $U \subset X$ with complement
$Z = X \setminus U$ such that
\begin{enumerate}
\item $U \to X$ is affine,
\item $j^{-1}(U) \to U$ is affine, and
\item $j(Y) \cap Z$ is closed.
\end{enumerate}
Then $j$ is affine. In particular, if $X$ is affine, so is $Y$.
\end{lemma}

\begin{proof}
By Schemes, Definition \ref{schemes-definition-immersion} there exists an
open subscheme $W \subset X$ such that $j$ factors as a closed immersion
$i : Y \to W$ followed by the inclusion morphism $W \to X$.
Since a closed immersion is affine
(Lemma \ref{lemma-closed-immersion-affine}),
we see that for every $x \in W$ there is an affine open
neighbourhood of $x$ in $X$ whose inverse image under $j$ is affine.
If $x \in U$, then the same thing is true by assumption (2).
Finally, assume $x \in Z$ and $x \not \in W$. Then $x \not \in j(Y) \cap Z$.
By assumption (3) we can find an affine open neighbourhood
$V \subset X$ of $x$ which does not meet $j(Y) \cap Z$.
Then $j^{-1}(V) = j^{-1}(V \cap U)$ which is affine
by assumptions (1) and (2). It follows that $j$ is affine by
Lemma \ref{lemma-characterize-affine}.
\end{proof}







\section{Families of ample invertible modules}
\label{section-families-ample-invertible-modules}

\noindent
A short section on the notion of a family of ample invertible modules.

\begin{definition}
\label{definition-family-ample-invertible-modules}
\begin{reference}
\cite[II Definition 2.2.4]{SGA6}
\end{reference}
Let $X$ be a scheme. Let $\{\mathcal{L}_i\}_{i \in I}$
be a family of invertible $\mathcal{O}_X$-modules. We say
$\{\mathcal{L}_i\}_{i \in I}$ is an
{\it ample family of invertible modules on $X$} if
\begin{enumerate}
\item $X$ is quasi-compact, and
\item for every $x \in X$ there exists an $i \in I$, an $n \geq 1$,
and $s \in \Gamma(X, \mathcal{L}_i^{\otimes n})$ such
that $x \in X_s$ and $X_s$ is affine.
\end{enumerate}
\end{definition}

\noindent
If $\{\mathcal{L}_i\}_{i \in I}$ is an ample family of invertible
modules on a scheme $X$, then there exists a finite subset $I' \subset I$ such
that $\{\mathcal{L}_i\}_{i \in I'}$ is an ample family of invertible
modules on $X$ (follows immediately from quasi-compactness).
A scheme having an ample family of invertible modules has an affine
diagonal by the next lemma and hence is a fortiori quasi-separated.

\begin{lemma}
\label{lemma-affine-diagonal}
Let $X$ be a scheme such that for every point $x \in X$ there exists
an invertible $\mathcal{O}_X$-module $\mathcal{L}$ and a global
section $s \in \Gamma(X, \mathcal{L})$ such that $x \in X_s$ and
$X_s$ is affine. Then the diagonal of $X$ is an affine morphism.
\end{lemma}

\begin{proof}
Given invertible $\mathcal{O}_X$-modules $\mathcal{L}$, $\mathcal{M}$
and global sections $s \in \Gamma(X, \mathcal{L})$,
$t \in \Gamma(X, \mathcal{M})$ such that $X_s$ and $X_t$ are affine
we have to prove $X_s \cap X_t$ is affine. Namely, then
Lemma \ref{lemma-characterize-affine}
applied to $\Delta : X \to X \times X$ and the fact that
$\Delta^{-1}(X_s \times X_t) = X_s \cap X_t$ shows that $\Delta$
is affine. The fact that $X_s \cap X_t$ is affine follows from
Properties, Lemma \ref{properties-lemma-affine-cap-s-open}.
\end{proof}

\begin{remark}
\label{remark-affine-s-opens-cover-family}
In Properties, Lemma \ref{properties-lemma-affine-s-opens-cover-quasi-separated}
we see that a scheme which has an ample invertible module
is separated. This is wrong for schemes having an ample
family of invertible modules. Namely, let $X$ be as in
Schemes, Example \ref{schemes-example-affine-space-zero-doubled}
with $n = 1$, i.e., the affine line with zero doubled.  We use the notation
of that example except that we write $x$ for $x_1$ and $y$
for $y_1$.  There is, for every integer $n$, an invertible
sheaf $\mathcal{L}_n$ on $X$ which is trivial on $X_1$ and
$X_2$ and whose transition function $U_{12} \to U_{21}$ is
$f(x) \mapsto y^n f(y)$.  The global sections of
$\mathcal{L}_n$ are pairs $(f(x), g(y)) \in k[x] \oplus
k[y]$ such that $y^n f(y) = g(y)$.  The sections $s = (1,
y)$ of $\mathcal{L}_1$ and $t = (x, 1)$ of
$\mathcal{L}_{-1}$ determine an open affine cover because
$X_s = X_1$ and $X_t = X_2$.  Therefore $X$ has an
ample family of invertible modules but it is not separated.
\end{remark}









\section{Quasi-affine morphisms}
\label{section-quasi-affine}

\noindent
Recall that a scheme $X$ is called {\it quasi-affine} if it is quasi-compact
and isomorphic to an open subscheme of an affine scheme, see
Properties, Definition \ref{properties-definition-quasi-affine}.

\begin{definition}
\label{definition-quasi-affine}
A morphism of schemes $f : X \to S$ is called {\it quasi-affine} if the
inverse image of every affine open of $S$ is a quasi-affine scheme.
\end{definition}

\begin{lemma}
\label{lemma-quasi-affine-separated}
A quasi-affine morphism is separated and quasi-compact.
\end{lemma}

\begin{proof}
Let $f : X \to S$ be quasi-affine.
Quasi-compactness is immediate from
Schemes, Lemma \ref{schemes-lemma-quasi-compact-affine}.
Let $U \subset S$ be an affine open. If we can show that
$f^{-1}(U)$ is a separated scheme, then $f$ is separated
(Schemes, Lemma \ref{schemes-lemma-characterize-separated}
shows that being separated is local on the base).
By assumption $f^{-1}(U)$ is isomorphic to an open subscheme
of an affine scheme. An affine scheme is separated and hence
every open subscheme of an affine scheme is separated as desired.
\end{proof}

\begin{lemma}
\label{lemma-characterize-quasi-affine}
Let $f : X \to S$ be a morphism of schemes.
The following are equivalent
\begin{enumerate}
\item The morphism $f$ is quasi-affine.
\item There exists an affine open covering $S = \bigcup W_j$
such that each $f^{-1}(W_j)$ is quasi-affine.
\item There exists a quasi-coherent sheaf of $\mathcal{O}_S$-algebras
$\mathcal{A}$ and a quasi-compact open immersion
$$
\xymatrix{
X \ar[rr] \ar[rd] & & \underline{\Spec}_S(\mathcal{A}) \ar[dl] \\
& S &
}
$$
over $S$.
\item Same as in (3) but with $\mathcal{A} = f_*\mathcal{O}_X$
and the horizontal arrow the canonical morphism of
Constructions, Lemma \ref{constructions-lemma-canonical-morphism}.
\end{enumerate}
\end{lemma}

\begin{proof}
It is obvious that (1) implies (2) and that (4) implies (3).

\medskip\noindent
Assume $S = \bigcup_{j \in J} W_j$ is an affine open covering such that
each $f^{-1}(W_j)$ is quasi-affine. By
Schemes, Lemma \ref{schemes-lemma-quasi-compact-affine} we see
that $f$ is quasi-compact. By
Schemes, Lemma \ref{schemes-lemma-characterize-quasi-separated}
we see the morphism $f$ is quasi-separated. Hence by
Schemes, Lemma \ref{schemes-lemma-push-forward-quasi-coherent} the
sheaf $\mathcal{A} = f_*\mathcal{O}_X$ is a quasi-coherent sheaf
of $\mathcal{O}_X$-algebras. Thus we have the scheme
$g : Y = \underline{\Spec}_S(\mathcal{A}) \to S$ over $S$.
The identity map
$\text{id} : \mathcal{A} = f_*\mathcal{O}_X \to f_*\mathcal{O}_X$
provides, via the definition of the relative spectrum,
a morphism $can : X \to Y$ over $S$, see
Constructions, Lemma \ref{constructions-lemma-canonical-morphism}.
By assumption, the lemma just cited, and
Properties, Lemma \ref{properties-lemma-quasi-affine}
the restriction $can|_{f^{-1}(W_j)} : f^{-1}(W_j) \to g^{-1}(W_j)$
is a quasi-compact open immersion. Thus $can$ is a quasi-compact
open immersion. We have shown that (2) implies (4).

\medskip\noindent
Assume (3). Choose any affine open $U \subset S$.
By Constructions, Lemma \ref{constructions-lemma-spec-properties}
we see that the inverse image of $U$ in the relative spectrum
is affine. Hence we conclude that $f^{-1}(U)$ is quasi-affine
(note that quasi-compactness is encoded in (3) as well).
Thus (3) implies (1).
\end{proof}

\begin{lemma}
\label{lemma-composition-quasi-affine}
The composition of quasi-affine morphisms is quasi-affine.
\end{lemma}

\begin{proof}
Let $f : X \to Y$ and $g : Y \to Z$ be quasi-affine morphisms.
Let $U \subset Z$ be affine open. Then $g^{-1}(U)$ is quasi-affine
by assumption on $g$. Let $j : g^{-1}(U) \to V$ be a quasi-compact
open immersion into an affine scheme $V$.
By Lemma \ref{lemma-characterize-quasi-affine} above
we see that $f^{-1}(g^{-1}(U))$
is a quasi-compact open subscheme of the relative spectrum
$\underline{\Spec}_{g^{-1}(U)}(\mathcal{A})$ for
some quasi-coherent sheaf of $\mathcal{O}_{g^{-1}(U)}$-algebras
$\mathcal{A}$. By
Schemes, Lemma \ref{schemes-lemma-push-forward-quasi-coherent}
the sheaf $\mathcal{A}' = j_*\mathcal{A}$
is a quasi-coherent sheaf of $\mathcal{O}_V$-algebras
with the property that $j^*\mathcal{A}' = \mathcal{A}$.
Hence we get a commutative diagram
$$
\xymatrix{
f^{-1}(g^{-1}(U)) \ar[r] &
\underline{\Spec}_{g^{-1}(U)}(\mathcal{A})
\ar[r] \ar[d] &
\underline{\Spec}_V(\mathcal{A}') \ar[d] \\
& g^{-1}(U) \ar[r]^j & V
}
$$
with the square being a fibre square,
see Constructions, Lemma \ref{constructions-lemma-spec-properties}.
Note that the upper right corner is an affine scheme.
Hence $(g \circ f)^{-1}(U)$ is quasi-affine.
\end{proof}

\begin{lemma}
\label{lemma-base-change-quasi-affine}
The base change of a quasi-affine morphism is quasi-affine.
\end{lemma}

\begin{proof}
Let $f : X \to S$ be a quasi-affine morphism.
By Lemma \ref{lemma-characterize-quasi-affine} above
we can find a quasi-coherent sheaf
of $\mathcal{O}_S$-algebras $\mathcal{A}$ and a quasi-compact
open immersion $X \to \underline{\Spec}_S(\mathcal{A})$
over $S$.
Let $g : S' \to S$ be any morphism.
Denote $f' : X_{S'} = S' \times_S X \to S'$ the base change of $f$.
Since the base change of a quasi-compact open immersion is
a quasi-compact open immersion we see that
$X_{S'} \to \underline{\Spec}_{S'}(g^*\mathcal{A})$
is a quasi-compact open immersion
(we have used Schemes, Lemmas
\ref{schemes-lemma-quasi-compact-preserved-base-change} and
\ref{schemes-lemma-base-change-immersion} and
Constructions, Lemma \ref{constructions-lemma-spec-properties}).
By Lemma \ref{lemma-characterize-quasi-affine} again
we conclude that $X_{S'} \to S'$ is quasi-affine.
\end{proof}

\begin{lemma}
\label{lemma-quasi-compact-immersion-quasi-affine}
A quasi-compact immersion is quasi-affine.
\end{lemma}

\begin{proof}
Let $X \to S$ be a quasi-compact immersion. We have to show the
inverse image of every affine open is quasi-affine. Hence,
assuming $S$ is an affine scheme, we have to show
$X$ is quasi-affine. By Lemma \ref{lemma-quasi-compact-immersion}
the morphism $X \to S$ factors as $X \to Z \to S$ where $Z$ is a closed
subscheme of $S$ and $X \subset Z$ is a quasi-compact open.
Since $S$ is affine Lemma \ref{lemma-closed-immersion} implies
$Z$ is affine. Hence we win.
\end{proof}

\begin{lemma}
\label{lemma-affine-quasi-affine}
Let $S$ be a scheme. Let $X$ be an affine scheme.
A morphism $f : X \to S$ is quasi-affine if and only if it is quasi-compact.
In particular any morphism from an affine scheme to a quasi-separated
scheme is quasi-affine.
\end{lemma}

\begin{proof}
Let $V \subset S$ be an affine open. Then $f^{-1}(V)$ is an open subscheme
of the affine scheme $X$, hence quasi-affine if and only if it is
quasi-compact. This proves the first assertion. The quasi-compactness of any
$f : X \to S$ where $X$ is affine and $S$ quasi-separated follows from
Schemes, Lemma \ref{schemes-lemma-quasi-compact-permanence}
applied to $X \to S \to \Spec(\mathbf{Z})$.
\end{proof}

\begin{lemma}
\label{lemma-quasi-affine-permanence}
Suppose $g : X \to Y$ is a morphism of schemes over $S$.
If $X$ is quasi-affine over $S$ and $Y$ is quasi-separated over $S$,
then $g$ is quasi-affine. In particular, any morphism from a
quasi-affine scheme to a quasi-separated scheme is quasi-affine.
\end{lemma}

\begin{proof}
The base change $X \times_S Y \to Y$ is quasi-affine by
Lemma \ref{lemma-base-change-quasi-affine}.
The morphism $X \to X \times_S Y$ is
a quasi-compact immersion as $Y \to S$ is quasi-separated, see
Schemes, Lemma \ref{schemes-lemma-section-immersion}.
A quasi-compact immersion is quasi-affine by
Lemma \ref{lemma-quasi-compact-immersion-quasi-affine}
and the composition of quasi-affine morphisms is quasi-affine
(see Lemma \ref{lemma-composition-quasi-affine}). Thus we win.
\end{proof}











\section{Types of morphisms defined by properties of ring maps}
\label{section-properties-ring-maps}

\noindent
In this section we study what properties of ring maps
allow one to define local properties of morphisms of schemes.

\begin{definition}
\label{definition-property-local}
Let $P$ be a property of ring maps.
\begin{enumerate}
\item We say that $P$ is {\it local} if the following hold:
\begin{enumerate}
\item For any ring map $R \to A$, and any $f \in R$ we have
$P(R \to A) \Rightarrow P(R_f \to A_f)$.
\item For any rings $R$, $A$, any $f \in R$, $a\in A$, and any ring map
$R_f \to A$ we have $P(R_f \to A) \Rightarrow P(R \to A_a)$.
\item For any ring map $R \to A$, and $a_i \in A$ such that
$(a_1, \ldots, a_n) = A$ then
$\forall i, P(R \to A_{a_i}) \Rightarrow P(R \to A)$.
\end{enumerate}
\item We say that $P$ is {\it stable under base change} if for any
ring maps $R \to A$, $R \to R'$ we have
$P(R \to A) \Rightarrow P(R' \to R' \otimes_R A)$.
\item We say that $P$ is {\it stable under composition} if for any
ring maps $A \to B$, $B \to C$ we have
$P(A \to B) \wedge P(B \to C) \Rightarrow P(A \to C)$.
\end{enumerate}
\end{definition}

\begin{definition}
\label{definition-locally-P}
Let $P$ be a property of ring maps.
Let $f : X \to S$ be a morphism of schemes.
We say $f$ is {\it locally of type $P$} if for any $x \in X$
there exists an affine open neighbourhood $U$ of $x$
in $X$ which maps into an affine open $V \subset S$ such that
the induced ring map $\mathcal{O}_S(V) \to \mathcal{O}_X(U)$
has property $P$.
\end{definition}

\noindent
This is not a ``good'' definition unless the property $P$ is
a local property. Even if $P$ is a local property we will not
automatically use this definition to say that a morphism is
``locally of type $P$'' unless we also explicitly state the
definition elsewhere.

\begin{lemma}
\label{lemma-locally-P}
Let $f : X \to S$ be a morphism of schemes.
Let $P$ be a property of ring maps.
Let $U$ be an affine open of $X$,
and $V$ an affine open of $S$ such that
$f(U) \subset V$.
If $f$ is locally of type $P$ and $P$ is local,
then $P(\mathcal{O}_S(V) \to \mathcal{O}_X(U))$ holds.
\end{lemma}

\begin{proof}
As $f$ is locally of type $P$ for every $u \in U$ there exists an
affine open $U_u \subset X$ mapping into an affine open $V_u \subset S$
such that $P(\mathcal{O}_S(V_u) \to \mathcal{O}_X(U_u))$ holds.
Choose an open neighbourhood $U'_u \subset U \cap U_u$ of $u$
which is standard affine open in both $U$ and $U_u$, see
Schemes, Lemma \ref{schemes-lemma-standard-open-two-affines}.
By Definition \ref{definition-property-local} (1)(b)
we see that $P(\mathcal{O}_S(V_u) \to \mathcal{O}_X(U'_u))$ holds.
Hence we may assume that $U_u \subset U$ is a standard affine open.
Choose an open neighbourhood $V'_u \subset V \cap V_u$
of $f(u)$ which is standard affine open in both $V$ and $V_u$, see
Schemes, Lemma \ref{schemes-lemma-standard-open-two-affines}.
Then $U'_u = f^{-1}(V'_u) \cap U_u$ is a standard affine open
of $U_u$ (hence of $U$) and we have
$P(\mathcal{O}_S(V'_u) \to \mathcal{O}_X(U'_u))$ by
Definition \ref{definition-property-local} (1)(a).
Hence we may assume both $U_u \subset U$ and $V_u \subset V$
are standard affine open. Applying
Definition \ref{definition-property-local} (1)(b)
one more time we conclude that $P(\mathcal{O}_S(V) \to \mathcal{O}_X(U_u))$
holds. Because $U$ is quasi-compact we may choose a finite number
of points $u_1, \ldots, u_n \in U$ such that
$$
U = U_{u_1} \cup \ldots \cup U_{u_n}.
$$
By Definition \ref{definition-property-local} (1)(c)
we conclude that $P(\mathcal{O}_S(V) \to \mathcal{O}_X(U))$ holds.
\end{proof}

\begin{lemma}
\label{lemma-locally-P-characterize}
Let $P$ be a local property of ring maps.
Let $f : X \to S$ be a morphism of schemes.
The following are equivalent
\begin{enumerate}
\item The morphism $f$ is locally of type $P$.
\item For every affine opens $U \subset X$, $V \subset S$
with $f(U) \subset V$ we have $P(\mathcal{O}_S(V) \to \mathcal{O}_X(U))$.
\item There exists an open covering $S = \bigcup_{j \in J} V_j$
and open coverings $f^{-1}(V_j) = \bigcup_{i \in I_j} U_i$ such
that each of the morphisms $U_i \to V_j$, $j\in J, i\in I_j$
is locally of type $P$.
\item There exists an affine open covering $S = \bigcup_{j \in J} V_j$
and affine open coverings $f^{-1}(V_j) = \bigcup_{i \in I_j} U_i$ such
that $P(\mathcal{O}_S(V_j) \to \mathcal{O}_X(U_i))$ holds, for all
$j\in J, i\in I_j$.
\end{enumerate}
Moreover, if $f$ is locally of type $P$ then for
any open subschemes $U \subset X$, $V \subset S$ with $f(U) \subset V$
the restriction $f|_U : U \to V$ is locally of type $P$.
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-locally-P} above.
\end{proof}

\begin{lemma}
\label{lemma-composition-type-P}
Let $P$ be a property of ring maps.
Assume $P$ is local and stable under composition.
The composition of morphisms locally of type $P$ is
locally of type $P$.
\end{lemma}

\begin{proof}
Let $f : X \to Y$ and $g : Y \to Z$ be morphisms locally of type $P$.
Let $x \in X$. Choose an affine open neighbourhood $W \subset Z$ of
$g(f(x))$. Choose an affine open neighbourhood $V \subset g^{-1}(W)$
of $f(x)$. Choose an affine open neighbourhood $U \subset f^{-1}(V)$
of $x$. By Lemma \ref{lemma-locally-P-characterize} the ring maps
$\mathcal{O}_Z(W) \to \mathcal{O}_Y(V)$ and
$\mathcal{O}_Y(V) \to \mathcal{O}_X(U)$ satisfy $P$.
Hence $\mathcal{O}_Z(W) \to \mathcal{O}_X(U)$ satisfies $P$
as $P$ is assumed stable under composition.
\end{proof}

\begin{lemma}
\label{lemma-base-change-type-P}
Let $P$ be a property of ring maps.
Assume $P$ is local and stable under base change.
The base change of a morphism locally of type $P$
is locally of type $P$.
\end{lemma}

\begin{proof}
Let $f : X \to S$ be a morphism locally of type $P$.
Let $S' \to S$ be any morphism. Denote
$f' : X_{S'} = S' \times_S X \to S'$ the base change of $f$.
For every $s' \in S'$ there exists an open affine neighbourhood
$s' \in V' \subset S'$ which maps into some open affine $V \subset S$.
By Lemma \ref{lemma-locally-P-characterize} the open $f^{-1}(V)$ is a
union of affines $U_i$ such that the ring maps
$\mathcal{O}_S(V) \to \mathcal{O}_X(U_i)$ all satisfy $P$.
By the material in Schemes, Section \ref{schemes-section-fibre-products}
we see that $f^{-1}(U)_{V'} = V' \times_V f^{-1}(V)$ is
the union of the affine opens $V' \times_V U_i$.
Since $\mathcal{O}_{X_{S'}}(V' \times_V U_i) =
\mathcal{O}_{S'}(V') \otimes_{\mathcal{O}_S(V)} \mathcal{O}_X(U_i)$
we see that the ring maps
$\mathcal{O}_{S'}(V') \to \mathcal{O}_{X_{S'}}(V' \times_V U_i)$
satisfy $P$ as $P$ is assumed stable under base change.
\end{proof}

\begin{lemma}
\label{lemma-properties-local}
The following properties of a ring map $R \to A$ are local.
\begin{enumerate}
\item (Isomorphism on local rings.)
For every prime $\mathfrak q$ of $A$ lying over $\mathfrak p \subset R$
the ring map $R \to A$ induces an isomorphism
$R_{\mathfrak p} \to A_{\mathfrak q}$.
\item (Open immersion.)
For every prime $\mathfrak q$ of $A$ there exists an $f \in R$,
$\varphi(f) \not \in \mathfrak q$ such that the ring map $\varphi : R \to A$
induces an isomorphism $R_f \to A_f$.
\item (Reduced fibres.)
For every prime $\mathfrak p$ of $R$ the fibre ring
$A \otimes_R \kappa(\mathfrak p)$ is reduced.
\item (Fibres of dimension at most $n$.)
For every prime $\mathfrak p$ of $R$ the fibre ring
$A \otimes_R \kappa(\mathfrak p)$ has Krull dimension at most $n$.
\item (Locally Noetherian on the target.)
The ring map $R \to A$ has the property that $A$ is Noetherian.
\item Add more here as needed\footnote{But only those properties
that are not already dealt with separately elsewhere.}.
\end{enumerate}
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-properties-base-change}
The following properties of ring maps are stable under base change.
\begin{enumerate}
\item (Isomorphism on local rings.)
For every prime $\mathfrak q$ of $A$ lying over $\mathfrak p \subset R$
the ring map $R \to A$ induces an isomorphism
$R_{\mathfrak p} \to A_{\mathfrak q}$.
\item (Open immersion.)
For every prime $\mathfrak q$ of $A$ there exists an $f \in R$,
$\varphi(f) \not \in \mathfrak q$ such that the ring map $\varphi : R \to A$
induces an isomorphism $R_f \to A_f$.
\item Add more here as needed\footnote{But only those properties
that are not already dealt with separately elsewhere.}.
\end{enumerate}
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-properties-composition}
The following properties of ring maps are stable under composition.
\begin{enumerate}
\item (Isomorphism on local rings.)
For every prime $\mathfrak q$ of $A$ lying over $\mathfrak p \subset R$
the ring map $R \to A$ induces an isomorphism
$R_{\mathfrak p} \to A_{\mathfrak q}$.
\item (Open immersion.)
For every prime $\mathfrak q$ of $A$ there exists an $f \in R$,
$\varphi(f) \not \in \mathfrak q$ such that the ring map $\varphi : R \to A$
induces an isomorphism $R_f \to A_f$.
\item (Locally Noetherian on the target.)
The ring map $R \to A$ has the property that $A$ is Noetherian.
\item Add more here as needed\footnote{But only those properties
that are not already dealt with separately elsewhere.}.
\end{enumerate}
\end{lemma}

\begin{proof}
Omitted.
\end{proof}








\section{Morphisms of finite type}
\label{section-finite-type}

\noindent
Recall that a ring map $R \to A$ is said to be of finite type if
$A$ is isomorphic to a quotient of $R[x_1, \ldots, x_n]$ as an $R$-algebra, see
Algebra, Definition \ref{algebra-definition-finite-type}.

\begin{definition}
\label{definition-finite-type}
Let $f : X \to S$ be a morphism of schemes.
\begin{enumerate}
\item We say that $f$ is of {\it finite type at $x \in X$} if
there exists an affine open neighbourhood $\Spec(A) = U \subset X$
of $x$ and an affine open $\Spec(R) = V \subset S$
with $f(U) \subset V$ such that the induced ring map
$R \to A$ is of finite type.
\item We say that $f$ is {\it locally of finite type} if it is
of finite type at every point of $X$.
\item We say that $f$ is of {\it finite type} if it is locally of
finite type and quasi-compact.
\end{enumerate}
\end{definition}

\begin{lemma}
\label{lemma-locally-finite-type-characterize}
Let $f : X \to S$ be a morphism of schemes.
The following are equivalent
\begin{enumerate}
\item The morphism $f$ is locally of finite type.
\item For all affine opens $U \subset X$, $V \subset S$
with $f(U) \subset V$ the ring map
$\mathcal{O}_S(V) \to \mathcal{O}_X(U)$ is of finite type.
\item There exist an open covering $S = \bigcup_{j \in J} V_j$
and open coverings $f^{-1}(V_j) = \bigcup_{i \in I_j} U_i$ such
that each of the morphisms $U_i \to V_j$, $j\in J, i\in I_j$
is locally of finite type.
\item There exist an affine open covering $S = \bigcup_{j \in J} V_j$
and affine open coverings $f^{-1}(V_j) = \bigcup_{i \in I_j} U_i$ such
that the ring map $\mathcal{O}_S(V_j) \to \mathcal{O}_X(U_i)$ is
of finite type, for all $j\in J, i\in I_j$.
\end{enumerate}
Moreover, if $f$ is locally of finite type then for
any open subschemes $U \subset X$, $V \subset S$ with $f(U) \subset V$
the restriction $f|_U : U \to V$ is locally of finite type.
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-locally-P} if we show that
the property ``$R \to A$ is of finite type'' is local.
We check conditions (a), (b) and (c) of Definition
\ref{definition-property-local}.
By Algebra, Lemma \ref{algebra-lemma-base-change-finiteness}
being of finite type is stable under base change and hence
we conclude (a) holds. By Algebra, Lemma
\ref{algebra-lemma-compose-finite-type} being of finite type
is stable under composition and trivially for any ring
$R$ the ring map $R \to R_f$ is of finite type.
We conclude (b) holds. Finally, property (c) is true
according to Algebra, Lemma \ref{algebra-lemma-cover-upstairs}.
\end{proof}

\begin{lemma}
\label{lemma-composition-finite-type}
The composition of two morphisms which are locally of finite type is
locally of finite type. The same is true for morphisms of finite type.
\end{lemma}

\begin{proof}
In the proof of Lemma \ref{lemma-locally-finite-type-characterize}
we saw that being of finite type is a local property of ring maps.
Hence the first statement of the lemma follows from
Lemma \ref{lemma-composition-type-P} combined
with the fact that being of finite type is a property of ring maps that is
stable under composition, see
Algebra, Lemma \ref{algebra-lemma-compose-finite-type}.
By the above and the fact that compositions of
quasi-compact morphisms are quasi-compact, see
Schemes, Lemma \ref{schemes-lemma-composition-quasi-compact}
we see that the composition of morphisms of finite type is
of finite type.
\end{proof}

\begin{lemma}
\label{lemma-base-change-finite-type}
The base change of a morphism which is locally of finite type
is locally of finite type. The same is true for morphisms of
finite type.
\end{lemma}

\begin{proof}
In the proof of Lemma \ref{lemma-locally-finite-type-characterize}
we saw that being of finite type is a local property of ring maps.
Hence the first statement of the lemma follows from
Lemma \ref{lemma-base-change-type-P} combined
with the fact that being of finite type is a property of ring maps that is
stable under base change, see
Algebra, Lemma \ref{algebra-lemma-base-change-finiteness}.
By the above and the fact that a base change of a
quasi-compact morphism is quasi-compact, see
Schemes, Lemma \ref{schemes-lemma-quasi-compact-preserved-base-change}
we see that the base change of a morphism of finite type is
a morphism of finite type.
\end{proof}

\begin{lemma}
\label{lemma-immersion-locally-finite-type}
A closed immersion is of finite type.
An immersion is locally of finite type.
\end{lemma}

\begin{proof}
This is true because an open immersion is a local isomorphism,
and a closed immersion is obviously of finite type.
\end{proof}

\begin{lemma}
\label{lemma-finite-type-noetherian}
Let $f : X \to S$ be a morphism.
If $S$ is (locally) Noetherian and $f$ (locally) of finite type
then $X$ is (locally) Noetherian.
\end{lemma}

\begin{proof}
This follows immediately from the fact that a ring
of finite type over a Noetherian ring is Noetherian,
see Algebra, Lemma \ref{algebra-lemma-Noetherian-permanence}.
(Also: use the fact that the source of a quasi-compact morphism
with quasi-compact target is quasi-compact.)
\end{proof}

\begin{lemma}
\label{lemma-finite-type-Noetherian-quasi-separated}
Let $f : X \to S$ be locally of finite type with $S$ locally Noetherian.
Then $f$ is quasi-separated.
\end{lemma}

\begin{proof}
In fact, it is true that $X$ is quasi-separated, see
Properties, Lemma \ref{properties-lemma-locally-Noetherian-quasi-separated}
and Lemma \ref{lemma-finite-type-noetherian} above.
Then apply Schemes, Lemma \ref{schemes-lemma-compose-after-separated}
to conclude that $f$ is quasi-separated.
\end{proof}

\begin{lemma}
\label{lemma-permanence-finite-type}
Let $X \to Y$ be a morphism of schemes over a base scheme $S$.
If $X$ is locally of finite type over $S$, then $X \to Y$
is locally of finite type.
\end{lemma}

\begin{proof}
Via Lemma \ref{lemma-locally-finite-type-characterize} this translates
into the following algebra
fact: Given ring maps $A \to B \to C$ such that $A \to C$ is
of finite type, then $B \to C$ is of finite type.
(See
Algebra, Lemma \ref{algebra-lemma-compose-finite-type}).
\end{proof}







\section{Points of finite type and Jacobson schemes}
\label{section-points-finite-type}

\noindent
Let $S$ be a scheme. A finite type point $s$ of $S$ is a point such
that the morphism $\Spec(\kappa(s)) \to S$ is of finite type.
The reason for studying this is that finite type points can replace
closed points in a certain sense and in certain situations.
There are always enough of them for example. Moreover, a scheme
is Jacobson if and only if all finite type points are closed points.

\begin{lemma}
\label{lemma-point-finite-type}
Let $S$ be a scheme. Let $k$ be a field.
Let $f : \Spec(k) \to S$ be a morphism.
The following are equivalent:
\begin{enumerate}
\item The morphism $f$ is of finite type.
\item The morphism $f$ is locally of finite type.
\item There exists an affine open $U = \Spec(R)$ of $S$
such that $f$ corresponds to a finite ring map $R \to k$.
\item There exists an affine open $U = \Spec(R)$ of $S$
such that the image of $f$ consists of a closed point $u$ in $U$
and the field extension $k/\kappa(u)$ is finite.
\end{enumerate}
\end{lemma}

\begin{proof}
The equivalence of (1) and (2) is obvious as $\Spec(k)$
is a singleton and hence any morphism from it is quasi-compact.

\medskip\noindent
Suppose $f$ is locally of finite type. Choose any affine open
$\Spec(R) = U \subset S$ such that the image of $f$
is contained in $U$, and the ring map $R \to k$
is of finite type. Let $\mathfrak p \subset R$ be the kernel.
Then $R/\mathfrak p \subset k$ is of finite type. By
Algebra, Lemma \ref{algebra-lemma-field-finite-type-over-domain}
there exist a $\overline{f} \in R/\mathfrak p$ such that
$(R/\mathfrak p)_{\overline{f}}$ is a field and
$(R/\mathfrak p)_{\overline{f}} \to k$ is a finite field
extension. If $f \in R$ is a lift of $\overline{f}$, then
we see that $k$ is a finite $R_f$-module. Thus (2) $\Rightarrow$ (3).

\medskip\noindent
Suppose that $\Spec(R) = U \subset S$ is an affine open
such that $f$ corresponds to a finite ring map $R \to k$.
Then $f$ is locally of finite type
by Lemma \ref{lemma-locally-finite-type-characterize}.
Thus (3) $\Rightarrow$ (2).

\medskip\noindent
Suppose $R \to k$ is finite. The image of $R \to k$ is a field
over which $k$ is finite by
Algebra, Lemma \ref{algebra-lemma-integral-under-field}.
Hence the kernel of $R \to k$ is a maximal ideal.
Thus (3) $\Rightarrow$ (4).

\medskip\noindent
The implication (4) $\Rightarrow$ (3) is immediate.
\end{proof}

\begin{lemma}
\label{lemma-artinian-finite-type}
Let $S$ be a scheme.
Let $A$ be an Artinian local ring with residue field $\kappa$.
Let $f : \Spec(A) \to S$ be a morphism of schemes.
Then $f$ is of finite type if and only if the composition
$\Spec(\kappa) \to \Spec(A) \to S$ is of finite type.
\end{lemma}

\begin{proof}
Since the morphism $\Spec(\kappa) \to \Spec(A)$ is of finite
type it is clear that if $f$ is of finite type so is the composition
$\Spec(\kappa) \to S$ (see Lemma \ref{lemma-composition-finite-type}).
For the converse, note that $\Spec(A) \to S$ maps into some affine open
$U = \Spec(B)$ of $S$ as $\Spec(A)$ has only one point. To finish
apply Algebra, Lemma
\ref{algebra-lemma-essentially-of-finite-type-into-artinian-local}
to $B \to A$.
\end{proof}

\noindent
Recall that given a point $s$ of a scheme $S$ there is a canonical
morphism $\Spec(\kappa(s)) \to S$, see
Schemes, Section \ref{schemes-section-points}.

\begin{definition}
\label{definition-finite-type-point}
Let $S$ be a scheme.
Let us say that a point $s$ of $S$ is a {\it finite type point}
if the canonical morphism $\Spec(\kappa(s)) \to S$ is of finite type.
We denote $S_{\text{ft-pts}}$ the set of finite type points of $S$.
\end{definition}

\noindent
We can describe the set of finite type points as follows.

\begin{lemma}
\label{lemma-identify-finite-type-points}
Let $S$ be a scheme. We have
$$
S_{\text{ft-pts}} = \bigcup\nolimits_{U \subset S\text{ open}} U_0
$$
where $U_0$ is the set of closed points of $U$.
Here we may let $U$ range over all opens or over all affine opens of $S$.
\end{lemma}

\begin{proof}
Immediate from Lemma \ref{lemma-point-finite-type}.
\end{proof}

\begin{lemma}
\label{lemma-finite-type-points-morphism}
Let $f : T \to S$ be a morphism of schemes.
If $f$ is locally of finite type, then
$f(T_{\text{ft-pts}}) \subset S_{\text{ft-pts}}$.
\end{lemma}

\begin{proof}
If $T$ is the spectrum of a field this is Lemma \ref{lemma-point-finite-type}.
In general it follows since the composition of morphisms locally of finite
type is locally of finite type (Lemma \ref{lemma-composition-finite-type}).
\end{proof}

\begin{lemma}
\label{lemma-finite-type-points-surjective-morphism}
Let $f : T \to S$ be a morphism of schemes.
If $f$ is locally of finite type and surjective, then
$f(T_{\text{ft-pts}}) = S_{\text{ft-pts}}$.
\end{lemma}

\begin{proof}
We have $f(T_{\text{ft-pts}}) \subset S_{\text{ft-pts}}$ by
Lemma \ref{lemma-finite-type-points-morphism}.
Let $s \in S$ be a finite type point. As $f$ is surjective the scheme
$T_s = \Spec(\kappa(s)) \times_S T$ is nonempty, therefore
has a finite type point $t \in T_s$ by
Lemma \ref{lemma-identify-finite-type-points}.
Now $T_s \to T$ is a morphism of finite type as a base change
of $s \to S$
(Lemma \ref{lemma-base-change-finite-type}).
Hence the image of $t$ in $T$ is a finite type point by
Lemma \ref{lemma-finite-type-points-morphism}
which maps to $s$ by construction.
\end{proof}

\begin{lemma}
\label{lemma-enough-finite-type-points}
Let $S$ be a scheme.
For any locally closed subset $T \subset S$ we have
$$
T \not = \emptyset
\Rightarrow
T \cap S_{\text{ft-pts}} \not = \emptyset.
$$
In particular, for any closed subset $T \subset S$ we
see that $T \cap S_{\text{ft-pts}}$ is dense in $T$.
\end{lemma}

\begin{proof}
Note that $T$ carries a scheme structure (see
Schemes, Lemma \ref{schemes-lemma-reduced-closed-subscheme})
such that $T \to S$ is a locally closed immersion.
Any locally closed immersion is locally of finite type,
see Lemma \ref{lemma-immersion-locally-finite-type}.
Hence by Lemma \ref{lemma-finite-type-points-morphism}
we see $T_{\text{ft-pts}} \subset S_{\text{ft-pts}}$.
Finally, any nonempty affine open of $T$ has at least one closed point
which is a finite type point of $T$ by
Lemma \ref{lemma-identify-finite-type-points}.
\end{proof}

\noindent
It follows that most of the material from
Topology, Section \ref{topology-section-space-jacobson} goes through
with the set of closed points replaced by the set of points of
finite type.
In fact, if $S$ is Jacobson then we recover the closed points as
the finite type points.

\begin{lemma}
\label{lemma-jacobson-finite-type-points}
Let $S$ be a scheme. The following are equivalent:
\begin{enumerate}
\item the scheme $S$ is Jacobson,
\item $S_{\text{ft-pts}}$ is the set of closed points of $S$,
\item for all $T \to S$ locally of finite type
closed points map to closed points, and
\item for all $T \to S$ locally of finite type
closed points $t \in T$ map to closed points $s \in S$ with
$\kappa(s) \subset \kappa(t)$ finite.
\end{enumerate}
\end{lemma}

\begin{proof}
We have trivially (4) $\Rightarrow$ (3) $\Rightarrow$ (2).
Lemma \ref{lemma-enough-finite-type-points} shows that (2) implies (1).
Hence it suffices to show that (1) implies (4).
Suppose that $T \to S$ is locally of finite type.
Choose $t \in T$ closed and let $s \in S$ be the image.
Choose affine open neighbourhoods $\Spec(R) = U \subset S$ of $s$ and
$\Spec(A) = V \subset T$ of $t$ with $V$ mapping into $U$.
The induced ring map $R \to A$ is of finite type
(see Lemma \ref{lemma-locally-finite-type-characterize}) and $R$ is Jacobson
by Properties, Lemma \ref{properties-lemma-locally-jacobson}.
Thus the result follows from
Algebra, Proposition \ref{algebra-proposition-Jacobson-permanence}.
\end{proof}

\begin{lemma}
\label{lemma-Jacobson-universally-Jacobson}
Let $S$ be a Jacobson scheme.
Any scheme locally of finite type over $S$ is Jacobson.
\end{lemma}

\begin{proof}
This is clear from
Algebra, Proposition \ref{algebra-proposition-Jacobson-permanence}
(and Properties, Lemma \ref{properties-lemma-locally-jacobson} and
Lemma \ref{lemma-locally-finite-type-characterize}).
\end{proof}

\begin{lemma}
\label{lemma-ubiquity-Jacobson-schemes}
The following types of schemes are Jacobson.
\begin{enumerate}
\item Any scheme locally of finite type over a field.
\item Any scheme locally of finite type over $\mathbf{Z}$.
\item Any scheme locally of finite type over a $1$-dimensional
Noetherian domain with infinitely many primes.
\item A scheme of the form $\Spec(R) \setminus \{\mathfrak m\}$
where $(R, \mathfrak m)$ is a Noetherian local ring.
Also any scheme locally of finite type over it.
\end{enumerate}
\end{lemma}

\begin{proof}
We will use Lemma \ref{lemma-Jacobson-universally-Jacobson} without mention.
The spectrum of a field is clearly Jacobson.
The spectrum of $\mathbf{Z}$ is Jacobson, see
Algebra, Lemma \ref{algebra-lemma-pid-jacobson}.
For (3) see
Algebra, Lemma \ref{algebra-lemma-noetherian-dim-1-Jacobson}.
For (4) see
Properties, Lemma \ref{properties-lemma-complement-closed-point-Jacobson}.
\end{proof}







\section{Universally catenary schemes}
\label{section-universally-catenary}

\noindent
Recall that a topological space $X$ is called {\it catenary} if
for every pair of irreducible closed subsets $T \subset T'$
there exist a maximal chain of irreducible closed subsets
$$
T = T_0 \subset T_1 \subset \ldots \subset T_e = T'
$$
and every such chain has the same length. See
Topology, Definition \ref{topology-definition-catenary}.
Recall that a scheme is catenary if its underlying topological space
is catenary. See Properties, Definition \ref{properties-definition-catenary}.

\begin{definition}
\label{definition-universally-catenary}
Let $S$ be a scheme. Assume $S$ is locally Noetherian.
We say $S$ is {\it universally catenary} if for every
morphism $X \to S$ locally of finite type the scheme $X$ is catenary.
\end{definition}

\noindent
This is a ``better'' notion than catenary as there exist Noetherian schemes
which are catenary but not universally catenary. See
Examples, Section \ref{examples-section-non-catenary-Noetherian-local}.
Many schemes are universally catenary, see
Lemma \ref{lemma-ubiquity-uc} below.

\medskip\noindent
Recall that a ring $A$ is called {\it catenary} if
for any pair of prime ideals $\mathfrak p \subset \mathfrak q$
there exists a maximal chain of primes
$$
\mathfrak p =
\mathfrak p_0 \subset \ldots \subset \mathfrak p_e
= \mathfrak q
$$
and all of these have the same length. See
Algebra, Definition \ref{algebra-definition-catenary}.
We have seen the relationship between catenary schemes and
catenary rings in Properties, Section \ref{properties-section-catenary}.
Recall that a ring $A$ is called {\it universally catenary} if
$A$ is Noetherian and for every finite type ring map $A \to B$
the ring $B$ is catenary. See
Algebra, Definition \ref{algebra-definition-universally-catenary}.
Many interesting rings which come up
in algebraic geometry satisfy this property.

\begin{lemma}
\label{lemma-universally-catenary-local}
Let $S$ be a locally Noetherian scheme. The following are equivalent
\begin{enumerate}
\item $S$ is universally catenary,
\item there exists an open covering of $S$ all of whose members are
universally catenary schemes,
\item for every affine open $\Spec(R) = U \subset S$ the ring
$R$ is universally catenary, and
\item there exists an affine open covering $S = \bigcup U_i$ such
that each $U_i$ is the spectrum of a universally catenary ring.
\end{enumerate}
Moreover, in this case any scheme locally of finite type over $S$
is universally catenary as well.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-immersion-locally-finite-type} an open immersion
is locally of finite type. A composition of morphisms locally of
finite type is locally of finite type
(Lemma \ref{lemma-composition-finite-type}). Thus it is clear that if $S$ is
universally catenary then any open and any scheme locally of finite
type over $S$ is universally catenary as well. This proves the final
statement of the lemma and that (1) implies (2).

\medskip\noindent
If $\Spec(R)$ is a universally catenary scheme, then every
scheme $\Spec(A)$ with $A$ a finite type $R$-algebra is
catenary. Hence all these rings $A$ are catenary by
Algebra, Lemma \ref{algebra-lemma-catenary}.
Thus $R$ is universally catenary. Combined with the remarks above we
conclude that (1) implies (3), and (2) implies (4). Of course
(3) implies (4) trivially.

\medskip\noindent
To finish the proof we show that (4) implies (1).
Assume (4) and let $X \to S$ be a morphism locally of finite type.
We can find an affine open covering $X = \bigcup V_j$ such that
each $V_j \to S$ maps into one of the $U_i$. By
Lemma \ref{lemma-locally-finite-type-characterize}
the induced ring map $\mathcal{O}(U_i) \to \mathcal{O}(V_j)$ is
of finite type. Hence $\mathcal{O}(V_j)$ is catenary. Hence
$X$ is catenary by Properties, Lemma \ref{properties-lemma-catenary-local}.
\end{proof}

\begin{lemma}
\label{lemma-universally-catenary-local-rings-universally-catenary}
Let $S$ be a locally Noetherian scheme.
The following are equivalent:
\begin{enumerate}
\item $S$ is universally catenary, and
\item all local rings $\mathcal{O}_{S, s}$ of $S$ are universally catenary.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume that all local rings of $S$ are universally catenary.
Let $f : X \to S$ be locally of finite type.
We know that $X$ is catenary if and only if $\mathcal{O}_{X, x}$ is
catenary for all $x \in X$. If $f(x) = s$, then $\mathcal{O}_{X, x}$
is essentially of finite type over $\mathcal{O}_{S, s}$. Hence
$\mathcal{O}_{X, x}$ is catenary by the assumption that
$\mathcal{O}_{S, s}$ is universally catenary.

\medskip\noindent
Conversely, assume that $S$ is universally catenary. Let $s \in S$.
We may replace $S$ by an affine open neighbourhood of $s$ by
Lemma \ref{lemma-universally-catenary-local}. Say $S = \Spec(R)$
and $s$ corresponds to the prime ideal $\mathfrak p$. Any finite
type $R_{\mathfrak p}$-algebra $A'$ is of the form
$A_{\mathfrak p}$ for some finite type $R$-algebra $A$.
By assumption (and Lemma \ref{lemma-universally-catenary-local} if you like)
the ring $A$ is catenary, and hence $A'$ (a localization of $A$) is
catenary. Thus $R_{\mathfrak p}$ is universally catenary.
\end{proof}

\begin{lemma}
\label{lemma-catenary-check-irreducible}
Let $S$ be a locally Noetherian scheme. Then $S$ is universally catenary
if and only if the irreducible components of $S$ are universally catenary.
\end{lemma}

\begin{proof}
Omitted. For the affine case, please see
Algebra, Lemma \ref{algebra-lemma-catenary-check-irreducible}.
\end{proof}

\begin{lemma}
\label{lemma-ubiquity-uc}
The following types of schemes are universally catenary.
\begin{enumerate}
\item Any scheme locally of finite type over a field.
\item Any scheme locally of finite type over a Cohen-Macaulay scheme.
\item Any scheme locally of finite type over $\mathbf{Z}$.
\item Any scheme locally of finite type over a $1$-dimensional
Noetherian domain.
\item And so on.
\end{enumerate}
\end{lemma}

\begin{proof}
All of these follow from the fact that a
Cohen-Macaulay ring is universally catenary, see
Algebra, Lemma \ref{algebra-lemma-CM-ring-catenary}.
Also, use the last assertion of
Lemma \ref{lemma-universally-catenary-local}.
Some details omitted.
\end{proof}























\section{Nagata schemes, reprise}
\label{section-nagata}

\noindent
See Properties, Section \ref{properties-section-nagata} for the definitions
and basic properties of Nagata and universally Japanese schemes.

\begin{lemma}
\label{lemma-finite-type-nagata}
Let $f : X \to S$ be a morphism.
If $S$ is Nagata and $f$ locally of finite type then $X$ is Nagata.
If $S$ is universally Japanese
and $f$ locally of finite type then $X$ is universally Japanese.
\end{lemma}

\begin{proof}
For ``universally Japanese'' this follows from
Algebra, Lemma \ref{algebra-lemma-universally-japanese}.
For ``Nagata'' this follows from
Algebra, Proposition \ref{algebra-proposition-nagata-universally-japanese}.
\end{proof}

\begin{lemma}
\label{lemma-ubiquity-nagata}
The following types of schemes are Nagata.
\begin{enumerate}
\item Any scheme locally of finite type over a field.
\item Any scheme locally of finite type over a Noetherian complete local ring.
\item Any scheme locally of finite type over $\mathbf{Z}$.
\item Any scheme locally of finite type over a Dedekind ring of
characteristic zero.
\item And so on.
\end{enumerate}
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-finite-type-nagata} we only need to show that
the rings mentioned above are Nagata rings. For this see
Algebra, Proposition \ref{algebra-proposition-ubiquity-nagata}.
\end{proof}


\section{The singular locus, reprise}
\label{section-singular-locus}

\noindent
We look for a criterion that implies openness of the regular locus for
any scheme locally of finite type over the base. Here is the definition.

\begin{definition}
\label{definition-J}
Let $X$ be a locally Noetherian scheme. We say $X$ is {\it J-2}
if for every morphism $Y \to X$ which is locally of finite type
the regular locus $\text{Reg}(Y)$ is open in $Y$.
\end{definition}

\noindent
This is the analogue of the corresponding notion for Noetherian
rings, see More on Algebra, Definition \ref{more-algebra-definition-J}.

\begin{lemma}
\label{lemma-J}
Let $X$ be a locally Noetherian scheme. The following are equivalent
\begin{enumerate}
\item $X$ is J-2,
\item there exists an open covering of $X$ all of whose members are
J-2 schemes,
\item for every affine open $\Spec(R) = U \subset X$ the ring
$R$ is J-2, and
\item there exists an affine open covering $S = \bigcup U_i$ such
that each $\mathcal{O}(U_i)$ is J-2 for all $i$.
\end{enumerate}
Moreover, in this case any scheme locally of finite type over $X$
is J-2 as well.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-immersion-locally-finite-type} an open immersion
is locally of finite type. A composition of morphisms locally of
finite type is locally of finite type
(Lemma \ref{lemma-composition-finite-type}). Thus it is clear that if $X$ is
J-2 then any open and any scheme locally of finite
type over $X$ is J-2 as well. This proves the final
statement of the lemma.

\medskip\noindent
If $\Spec(R)$ is J-2, then for every finite type $R$-algebra $A$
the regular locus of the scheme $\Spec(A)$ is open. Hence $R$ is
J-2, by definition (see
More on Algebra, Definition \ref{more-algebra-definition-J}).
Combined with the remarks above we conclude that (1) implies (3), and
(2) implies (4). Of course (1) $\Rightarrow$ (2) and
(3) $\Rightarrow$ (4) trivially.

\medskip\noindent
To finish the proof we show that (4) implies (1).
Assume (4) and let $Y \to X$ be a morphism locally of finite type.
We can find an affine open covering $Y = \bigcup V_j$ such that
each $V_j \to X$ maps into one of the $U_i$. By
Lemma \ref{lemma-locally-finite-type-characterize}
the induced ring map $\mathcal{O}(U_i) \to \mathcal{O}(V_j)$ is
of finite type. Hence the regular locus of
$V_j = \Spec(\mathcal{O}(V_j))$ is open. Since
$\text{Reg}(Y) \cap V_j = \text{Reg}(V_j)$ we conclude that
$\text{Reg}(Y)$ is open as desired.
\end{proof}

\begin{lemma}
\label{lemma-ubiquity-J-2}
The following types of schemes are J-2.
\begin{enumerate}
\item Any scheme locally of finite type over a field.
\item Any scheme locally of finite type over a Noetherian complete local ring.
\item Any scheme locally of finite type over $\mathbf{Z}$.
\item Any scheme locally of finite type over a Noetherian local ring
of dimension $1$.
\item Any scheme locally of finite type over a Nagata ring of dimension $1$.
\item Any scheme locally of finite type over a Dedekind ring of
characteristic zero.
\item And so on.
\end{enumerate}
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-J} we only need to show that
the rings mentioned above are J-2. For this see
More on Algebra, Proposition \ref{more-algebra-proposition-ubiquity-J-2}.
\end{proof}



\section{Quasi-finite morphisms}
\label{section-quasi-finite}

\noindent
A solid treatment of quasi-finite morphisms is the basis of many developments
further down the road. It will lead to various versions of Zariski's Main
Theorem, behaviour of dimensions of fibres, descent for \'etale morphisms, etc,
etc. Before reading this section it may be a good idea to take a look at
the algebra results in Algebra, Section \ref{algebra-section-quasi-finite}.

\medskip\noindent
Recall that a finite type ring map $R \to A$ is quasi-finite at
a prime $\mathfrak q$ if $\mathfrak q$ defines an isolated point
of its fibre, see Algebra, Definition \ref{algebra-definition-quasi-finite}.

\begin{definition}
\label{definition-quasi-finite}
\begin{reference}
\cite[II Definition 6.2.3]{EGA}
\end{reference}
Let $f : X \to S$ be a morphism of schemes.
\begin{enumerate}
\item We say that $f$ is {\it quasi-finite at a point $x \in X$}
if there exist an affine neighbourhood $\Spec(A) = U \subset X$
of $x$ and an affine open $\Spec(R) = V \subset S$ such that
$f(U) \subset V$, the ring map $R \to A$ is of finite type,
and $R \to A$ is quasi-finite at the prime of $A$ corresponding to $x$
(see above).
\item We say $f$ is {\it locally quasi-finite} if $f$ is
quasi-finite at every point $x$ of $X$.
\item We say that $f$ is {\it quasi-finite} if $f$ is of finite type
and every point $x$ is an isolated point of its fibre.
\end{enumerate}
\end{definition}

\noindent
Trivially, a locally quasi-finite morphism is locally of finite type.
We will see below that a morphism $f$ which is locally of finite type
is quasi-finite at $x$ if and only if $x$ is isolated in its fibre.
Moreover, the set of points at which a morphism is quasi-finite is open;
we will see this in Section \ref{section-Zariski} on Zariski's Main Theorem.

\begin{lemma}
\label{lemma-algebraic-residue-field-extension-closed-point-fibre}
Let $f : X \to S$ be a morphism of schemes.
Let $x \in X$ be a point. Set $s = f(x)$.
If $\kappa(x)/\kappa(s)$
is an algebraic field extension, then
\begin{enumerate}
\item $x$ is a closed point of its fibre, and
\item if in addition $s$ is a closed point of $S$, then
$x$ is a closed point of $X$.
\end{enumerate}
\end{lemma}

\begin{proof}
The second statement follows from the first by elementary topology.
According to Schemes, Lemma \ref{schemes-lemma-fibre-topological}
to prove the first statement
we may replace $X$ by $X_s$ and $S$ by $\Spec(\kappa(s))$.
Thus we may assume that $S = \Spec(k)$ is the spectrum of a field.
In this case, let $\Spec(A) = U \subset X$ be any affine open
containing $x$. The point $x$ corresponds to a prime ideal
$\mathfrak q \subset A$ such that $\kappa(\mathfrak q)/k$
is an algebraic field extension. By
Algebra, Lemma \ref{algebra-lemma-finite-residue-extension-closed}
we see that $\mathfrak q$ is a maximal ideal, i.e., $x \in U$ is a
closed point. Since the affine opens form
a basis of the topology of $X$ we conclude that $\{x\}$ is closed.
\end{proof}

\noindent
The following lemma is a version of the Hilbert Nullstellensatz.

\begin{lemma}
\label{lemma-closed-point-fibre-locally-finite-type}
Let $f : X \to S$ be a morphism of schemes.
Let $x \in X$ be a point. Set $s = f(x)$.
Assume $f$ is locally of finite type.
Then $x$ is a closed point of its fibre
if and only if $\kappa(x)/\kappa(s)$ is
a finite field extension.
\end{lemma}

\begin{proof}
If the extension is finite, then $x$ is a closed point of
the fibre by
Lemma \ref{lemma-algebraic-residue-field-extension-closed-point-fibre}
above. For the converse, assume that $x$ is a closed point
of its fibre. Choose affine opens $\Spec(A) = U \subset X$
and $\Spec(R) = V \subset S$ such that $f(U) \subset V$.
By Lemma \ref{lemma-locally-finite-type-characterize} the ring map
$R \to A$ is of finite type. Let $\mathfrak q \subset A$,
resp.\ $\mathfrak p \subset R$ be the prime ideal corresponding
to $x$, resp.\ $s$. Consider the fibre ring
$\overline{A} = A \otimes_R \kappa(\mathfrak p)$.
Let $\overline{\mathfrak q}$ be the prime of $\overline{A}$
corresponding to $\mathfrak q$. The assumption that $x$
is a closed point of its fibre implies that $\overline{\mathfrak q}$
is a maximal ideal of $\overline{A}$. Since $\overline{A}$
is an algebra of finite type over the field $\kappa(\mathfrak p)$
we see by the Hilbert Nullstellensatz, see
Algebra, Theorem \ref{algebra-theorem-nullstellensatz},
that $\kappa(\overline{\mathfrak q})$ is a finite extension
of $\kappa(\mathfrak p)$.
Since $\kappa(s) = \kappa(\mathfrak p)$ and
$\kappa(x) = \kappa(\mathfrak q) = \kappa(\overline{\mathfrak q})$
we win.
\end{proof}

\begin{lemma}
\label{lemma-base-change-closed-point-fibre-locally-finite-type}
Let $f : X \to S$ be a morphism of schemes which is locally of finite type.
Let $g : S' \to S$ be any morphism. Denote $f' : X' \to S'$ the base change.
If $x' \in X'$ maps to a point $x \in X$ which is closed in $X_{f(x)}$
then $x'$ is closed in $X'_{f'(x')}$.
\end{lemma}

\begin{proof}
The residue field $\kappa(x')$ is a quotient of
$\kappa(f'(x')) \otimes_{\kappa(f(x))} \kappa(x)$, see
Schemes, Lemma \ref{schemes-lemma-points-fibre-product}.
Hence it is a finite extension of $\kappa(f'(x'))$ as
$\kappa(x)$ is a finite extension of $\kappa(f(x))$ by
Lemma \ref{lemma-closed-point-fibre-locally-finite-type}.
Thus we see that $x'$ is closed in its fibre by applying that lemma
one more time.
\end{proof}

\begin{lemma}
\label{lemma-residue-field-quasi-finite}
Let $f : X \to S$ be a morphism of schemes.
Let $x \in X$ be a point. Set $s = f(x)$.
If $f$ is quasi-finite at $x$, then the residue field
extension $\kappa(x)/\kappa(s)$ is finite.
\end{lemma}

\begin{proof}
This is clear from Algebra, Definition \ref{algebra-definition-quasi-finite}.
\end{proof}

\begin{lemma}
\label{lemma-quasi-finite-at-point-characterize}
Let $f : X \to S$ be a morphism of schemes.
Let $x \in X$ be a point. Set $s = f(x)$.
Let $X_s$ be the fibre of $f$ at $s$.
Assume $f$ is locally of finite type.
The following are equivalent:
\begin{enumerate}
\item The morphism $f$ is quasi-finite at $x$.
\item The point $x$ is isolated in $X_s$.
\item The point $x$ is closed in $X_s$
and there is no point $x' \in X_s$, $x' \not = x$
which specializes to $x$.
\item For any pair of affine opens
$\Spec(A) = U \subset X$, $\Spec(R) = V \subset S$ with
$f(U) \subset V$ and $x \in U$ corresponding to $\mathfrak q \subset A$
the ring map $R \to A$ is quasi-finite at $\mathfrak q$.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume $f$ is quasi-finite at $x$. By assumption there exist opens
$U \subset X$, $V \subset S$ such that $f(U) \subset V$, $x \in U$
and $x$ an isolated point of $U_s$. Hence $\{x\} \subset U_s$ is an open
subset. Since $U_s = U \cap X_s \subset X_s$ is also open we conclude
that $\{x\} \subset X_s$ is an open subset also. Thus we conclude
that $x$ is an isolated point of $X_s$.

\medskip\noindent
Note that $X_s$ is a Jacobson scheme by
Lemma \ref{lemma-ubiquity-Jacobson-schemes}
(and
Lemma \ref{lemma-base-change-finite-type}).
If $x$ is isolated in $X_s$, i.e., $\{x\} \subset X_s$ is open,
then $\{x\}$ contains a closed point (by the Jacobson property), hence
$x$ is closed in $X_s$. It is clear that there is no point $x' \in X_s$,
distinct from $x$, specializing to $x$.

\medskip\noindent
Assume that $x$ is closed in $X_s$ and that there is no point $x' \in X_s$,
distinct from $x$, specializing to $x$. Consider a pair of affine opens
$\Spec(A) = U \subset X$, $\Spec(R) = V \subset S$ with
$f(U) \subset V$ and $x \in U$. Let $\mathfrak q \subset A$ correspond to
$x$ and $\mathfrak p \subset R$ correspond to $s$.
By Lemma \ref{lemma-locally-finite-type-characterize} the ring map
$R \to A$ is of finite type. Consider the fibre ring
$\overline{A} = A \otimes_R \kappa(\mathfrak p)$.
Let $\overline{\mathfrak q}$ be the prime of $\overline{A}$ corresponding
to $\mathfrak q$. Since $\Spec(\overline{A})$ is an open subscheme of
the fibre $X_s$ we see that $\overline{q}$ is a maximal ideal
of $\overline{A}$ and that there is no point of $\Spec(\overline{A})$
specializing to $\overline{\mathfrak q}$.
This implies that $\dim(\overline{A}_{\overline{q}}) = 0$.
Hence by
Algebra, Definition \ref{algebra-definition-quasi-finite}
we see that $R \to A$ is quasi-finite at $\mathfrak q$, i.e.,
$X \to S$ is quasi-finite at $x$ by definition.

\medskip\noindent
At this point we have shown conditions (1) -- (3) are all equivalent.
It is clear that (4) implies (1). And it is also clear that
(2) implies (4) since if $x$ is an isolated point of $X_s$
then it is also an isolated point of $U_s$ for any open $U$
which contains it.
\end{proof}

\begin{lemma}
\label{lemma-finite-fibre}
Let $f : X \to S$ be a morphism of schemes.
Let $s \in S$. Assume that
\begin{enumerate}
\item $f$ is locally of finite type, and
\item $f^{-1}(\{s\})$ is a finite set.
\end{enumerate}
Then $X_s$ is a finite discrete topological space, and
$f$ is quasi-finite at each point of $X$ lying over $s$.
\end{lemma}

\begin{proof}
Suppose $T$ is a scheme which (a) is locally of finite type
over a field $k$, and (b) has finitely many points. Then
Lemma \ref{lemma-ubiquity-Jacobson-schemes} shows $T$ is a
Jacobson scheme. A finite Jacobson space is discrete, see
Topology, Lemma \ref{topology-lemma-finite-jacobson}.
Apply this remark to the fibre $X_s$ which is locally of finite type over
$\Spec(\kappa(s))$ to see the first statement. Finally, apply
Lemma \ref{lemma-quasi-finite-at-point-characterize} to see the second.
\end{proof}

\begin{lemma}
\label{lemma-locally-quasi-finite-fibres}
\begin{slogan}
Finite type morphisms with discrete fibers are quasi-finite.
\end{slogan}
Let $f : X \to S$ be a morphism of schemes.
Assume $f$ is locally of finite type.
Then the following are equivalent
\begin{enumerate}
\item $f$ is locally quasi-finite,
\item for every $s \in S$ the fibre $X_s$ is a discrete topological space, and
\item for every morphism $\Spec(k) \to S$ where $k$ is a field
the base change $X_k$ has an underlying discrete topological space.
\end{enumerate}
\end{lemma}

\begin{proof}
It is immediate that (3) implies (2).
Lemma \ref{lemma-quasi-finite-at-point-characterize}
shows that (2) is equivalent to (1).
Assume (2) and let $\Spec(k) \to S$ be as in (3).
Denote $s \in S$ the image  of $\Spec(k) \to S$.
Then $X_k$ is the base change of $X_s$ via
$\Spec(k) \to \Spec(\kappa(s))$. Hence every
point of $X_k$ is closed by
Lemma \ref{lemma-base-change-closed-point-fibre-locally-finite-type}.
As $X_k \to \Spec(k)$ is locally of finite type (by
Lemma \ref{lemma-base-change-finite-type}),
we may apply
Lemma \ref{lemma-quasi-finite-at-point-characterize}
to conclude that every point of $X_k$ is isolated, i.e., $X_k$ has
a discrete underlying topological space.
\end{proof}

\begin{lemma}
\label{lemma-quasi-finite-locally-quasi-compact}
Let $f : X \to S$ be a morphism of schemes.
Then $f$ is quasi-finite if and only if $f$ is
locally quasi-finite and quasi-compact.
\end{lemma}

\begin{proof}
Assume $f$ is quasi-finite. It is quasi-compact by Definition
\ref{definition-finite-type}. Let $x \in X$.
We see that $f$ is quasi-finite at $x$ by
Lemma \ref{lemma-quasi-finite-at-point-characterize}.
Hence $f$ is quasi-compact and locally quasi-finite.

\medskip\noindent
Assume $f$ is quasi-compact and locally quasi-finite.
Then $f$ is of finite type. Let $x \in X$ be a point.
By Lemma \ref{lemma-quasi-finite-at-point-characterize}
we see that $x$ is an isolated point of its fibre.
The lemma is proved.
\end{proof}

\begin{lemma}
\label{lemma-quasi-finite}
Let $f : X \to S$ be a morphism of schemes.
The following are equivalent:
\begin{enumerate}
\item $f$ is quasi-finite, and
\item $f$ is locally of finite type, quasi-compact, and has finite fibres.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume $f$ is quasi-finite. In particular $f$ is locally of finite type
and quasi-compact (since it is of finite type). Let $s \in S$. Since
every $x \in X_s$ is isolated in $X_s$ we see that
$X_s = \bigcup_{x \in X_s} \{x\}$ is an open covering. As $f$
is quasi-compact, the fibre $X_s$ is quasi-compact. Hence we see
that $X_s$ is finite.

\medskip\noindent
Conversely, assume $f$ is locally of finite type, quasi-compact
and has finite fibres. Then it is locally quasi-finite by
Lemma \ref{lemma-finite-fibre}. Hence it is quasi-finite by
Lemma \ref{lemma-quasi-finite-locally-quasi-compact}.
\end{proof}

\noindent
Recall that a ring map $R \to A$ is quasi-finite if it is
of finite type and quasi-finite at {\it all} primes of $A$, see
Algebra, Definition \ref{algebra-definition-quasi-finite}.

\begin{lemma}
\label{lemma-locally-quasi-finite-characterize}
Let $f : X \to S$ be a morphism of schemes.
The following are equivalent
\begin{enumerate}
\item The morphism $f$ is locally quasi-finite.
\item For every pair of affine opens $U \subset X$, $V \subset S$
with $f(U) \subset V$ the ring map
$\mathcal{O}_S(V) \to \mathcal{O}_X(U)$ is quasi-finite.
\item There exists an open covering $S = \bigcup_{j \in J} V_j$
and open coverings $f^{-1}(V_j) = \bigcup_{i \in I_j} U_i$ such
that each of the morphisms $U_i \to V_j$, $j\in J, i\in I_j$
is locally quasi-finite.
\item There exists an affine open covering $S = \bigcup_{j \in J} V_j$
and affine open coverings $f^{-1}(V_j) = \bigcup_{i \in I_j} U_i$ such
that the ring map $\mathcal{O}_S(V_j) \to \mathcal{O}_X(U_i)$ is
quasi-finite, for all $j\in J, i\in I_j$.
\end{enumerate}
Moreover, if $f$ is locally quasi-finite then for
any open subschemes $U \subset X$, $V \subset S$ with $f(U) \subset V$
the restriction $f|_U : U \to V$ is locally quasi-finite.
\end{lemma}

\begin{proof}
For a ring map $R \to A$ let us define
$P(R \to A)$ to mean ``$R \to A$ is quasi-finite''
(see remark above lemma).
We claim that $P$ is a local property of ring maps.
We check conditions (a), (b) and (c) of Definition
\ref{definition-property-local}. In the proof of
Lemma \ref{lemma-locally-finite-type-characterize}
we have seen that (a), (b) and (c) hold for the property
of being ``of finite type''. Note that, for a finite type ring map
$R \to A$, the property $R \to A$ is quasi-finite at $\mathfrak q$
depends only on the local ring $A_{\mathfrak q}$ as an
algebra over $R_{\mathfrak p}$ where $\mathfrak p = R \cap \mathfrak q$
(usual abuse of notation). Using these remarks (a), (b) and (c) of
Definition \ref{definition-property-local} follow immediately.
For example, suppose $R \to A$ is a ring map
such that all of the ring maps $R \to A_{a_i}$ are quasi-finite
for $a_1, \ldots, a_n \in A$ generating the unit ideal.
We conclude that $R \to A$ is of finite type. Also, for any
prime $\mathfrak q \subset A$ the local ring $A_{\mathfrak q}$
is isomorphic as an $R$-algebra to the local ring
$(A_{a_i})_{\mathfrak q_i}$ for some $i$ and some
$\mathfrak q_i \subset A_{a_i}$. Hence we conclude that
$R \to A$ is quasi-finite at $\mathfrak q$.

\medskip\noindent
We conclude that Lemma \ref{lemma-locally-P} applies with $P$
as in the previous paragraph.
Hence it suffices to prove that $f$ is locally quasi-finite is
equivalent to $f$ is locally of type $P$. Since $P(R \to A)$
is ``$R \to A$ is quasi-finite'' which means $R \to A$ is
quasi-finite at every prime of $A$, this follows from
Lemma \ref{lemma-quasi-finite-at-point-characterize}.
\end{proof}

\begin{lemma}
\label{lemma-composition-quasi-finite}
The composition of two morphisms which are locally quasi-finite is
locally quasi-finite. The same is true for quasi-finite morphisms.
\end{lemma}

\begin{proof}
In the proof of Lemma \ref{lemma-locally-quasi-finite-characterize}
we saw that $P = $``quasi-finite'' is a local property of ring maps,
and that a morphism of schemes is locally quasi-finite if and only if
it is locally of type $P$ as in Definition \ref{definition-locally-P}.
Hence the first statement of the lemma follows from
Lemma \ref{lemma-composition-type-P} combined
with the fact that being quasi-finite is a property of ring maps that is
stable under composition, see
Algebra, Lemma \ref{algebra-lemma-quasi-finite-composition}.
By the above, Lemma \ref{lemma-quasi-finite-locally-quasi-compact}
and the fact that compositions of
quasi-compact morphisms are quasi-compact, see
Schemes, Lemma \ref{schemes-lemma-composition-quasi-compact}
we see that the composition of quasi-finite morphisms is
quasi-finite.
\end{proof}

\noindent
We will see later (Lemma \ref{lemma-quasi-finite-points-open})
that the set $U$ of the following lemma is open.

\begin{lemma}
\label{lemma-base-change-quasi-finite}
\begin{slogan}
(Locally) quasi-finite morphisms are stable under base change.
\end{slogan}
Let $f : X \to S$ be a morphism of schemes.
Let $g : S' \to S$ be a morphism of schemes.
Denote $f' : X' \to S'$ the base change of $f$ by $g$
and denote $g' : X' \to X$ the projection.
Assume $X$ is locally of finite type over $S$.
\begin{enumerate}
\item Let $U \subset X$ (resp.\ $U' \subset X'$)
be the set of points where $f$ (resp.\ $f'$) is quasi-finite.
Then $U' = U \times_S S' = (g')^{-1}(U)$.
\item The base change of a locally quasi-finite morphism is
locally quasi-finite.
\item The base change of a quasi-finite morphism is
quasi-finite.
\end{enumerate}
\end{lemma}

\begin{proof}
The first and second assertion follow from the corresponding
algebra result, see
Algebra, Lemma \ref{algebra-lemma-quasi-finite-base-change}
(combined with the fact that $f'$ is also locally of finite type by
Lemma \ref{lemma-base-change-finite-type}).
By the above, Lemma \ref{lemma-quasi-finite-locally-quasi-compact}
and the fact that a base change of a
quasi-compact morphism is quasi-compact, see
Schemes, Lemma \ref{schemes-lemma-quasi-compact-preserved-base-change}
we see that the base change of a quasi-finite morphism
is quasi-finite.
\end{proof}

\begin{lemma}
\label{lemma-quasi-finite-at-a-finite-number-of-points}
Let $f : X \to S$ be a morphism of schemes of finite type.
Let $s \in S$. There are at most finitely many points
of $X$ lying over $s$ at which $f$ is quasi-finite.
\end{lemma}

\begin{proof}
The fibre $X_s$ is a scheme of finite type over a field,
hence Noetherian (Lemma \ref{lemma-finite-type-noetherian}).
Hence the topology on $X_s$ is Noetherian (Properties, Lemma
\ref{properties-lemma-Noetherian-topology})
and can have at most a finite number of isolated points (by elementary
topology). Thus our lemma follows from
Lemma \ref{lemma-quasi-finite-at-point-characterize}.
\end{proof}

\begin{lemma}
\label{lemma-monomorphism-loc-finite-type-loc-quasi-finite}
Let $f : X \to Y$ be a morphism of schemes.
If $f$ is locally of finite type and a monomorphism, then $f$
is separated and locally quasi-finite.
\end{lemma}

\begin{proof}
A monomorphism is separated by Schemes, Lemma
\ref{schemes-lemma-monomorphism-separated}.
A monomorphism is injective, hence we get $f$
is quasi-finite at every $x \in X$ for example by
Lemma \ref{lemma-quasi-finite-at-point-characterize}.
\end{proof}

\begin{lemma}
\label{lemma-immersion-locally-quasi-finite}
Any immersion is locally quasi-finite.
\end{lemma}

\begin{proof}
This is true because an open immersion is a local isomorphism
and a closed immersion is clearly quasi-finite.
\end{proof}

\begin{lemma}
\label{lemma-permanence-quasi-finite}
Let $X \to Y$ be a morphism of schemes over a base scheme $S$.
Let $x \in X$. If $X \to S$ is quasi-finite at $x$, then
$X \to Y$ is quasi-finite at $x$.
If $X$ is locally quasi-finite over $S$, then $X \to Y$
is locally quasi-finite.
\end{lemma}

\begin{proof}
Via Lemma \ref{lemma-locally-quasi-finite-characterize} this translates
into the following algebra
fact: Given ring maps $A \to B \to C$ such that $A \to C$ is
quasi-finite, then $B \to C$ is quasi-finite.
This follows from
Algebra, Lemma \ref{algebra-lemma-four-rings}
with $R = A$, $S = S' = C$ and $R' = B$.
\end{proof}

\begin{lemma}
\label{lemma-quasi-finite-local-source}
Let $f : X \to Y$ and $g : Y \to S$ be morphisms of schemes.
If $f$ is surjective, $g \circ f$ locally quasi-finite, and
$g$ locally of finite type, then $g : Y \to S$  is locally quasi-finite.
\end{lemma}

\begin{proof}
Let $x \in X$ with images $y \in Y$ and $s \in S$.
Since $g \circ f$ is locally quasi-finite by
Lemma \ref{lemma-residue-field-quasi-finite}
the extension $\kappa(x)/\kappa(s)$ is finite.
Hence $\kappa(y)/\kappa(s)$ is finite. Hence
$y$ is a closed point of $Y_s$ by
Lemma \ref{lemma-algebraic-residue-field-extension-closed-point-fibre}.
Since $f$ is surjective, we see that every point of $Y$ is
closed in its fibre over $S$. Thus by
Lemma \ref{lemma-quasi-finite-at-point-characterize}
we conclude that $g$ is quasi-finite at every point.
\end{proof}














\section{Morphisms of finite presentation}
\label{section-finite-presentation}

\noindent
Recall that a ring map $R \to A$ is of finite presentation if
$A$ is isomorphic to $R[x_1, \ldots, x_n]/(f_1, \ldots, f_m)$ as
an $R$-algebra for some $n, m$ and some polynomials $f_j$, see
Algebra, Definition \ref{algebra-definition-finite-type}.

\begin{definition}
\label{definition-finite-presentation}
Let $f : X \to S$ be a morphism of schemes.
\begin{enumerate}
\item We say that $f$ is of {\it finite presentation at $x \in X$} if
there exists an affine open neighbourhood $\Spec(A) = U \subset X$
of $x$ and affine open $\Spec(R) = V \subset S$
with $f(U) \subset V$ such that the induced ring map
$R \to A$ is of finite presentation.
\item We say that $f$ is {\it locally of finite presentation} if it is
of finite presentation at every point of $X$.
\item We say that $f$ is of {\it finite presentation} if it is locally of
finite presentation, quasi-compact and quasi-separated.
\end{enumerate}
\end{definition}

\noindent
Note that a morphism of finite presentation is {\bf not} just a quasi-compact
morphism which is locally of finite presentation.
Later we will characterize morphisms which are
locally of finite presentation as those morphisms such that
$$
\colim \Mor_S(T_i, X) = \Mor_S(\lim T_i, X)
$$
for any directed system of affine schemes $T_i$ over $S$. See
Limits,
Proposition \ref{limits-proposition-characterize-locally-finite-presentation}.
In Limits, Section \ref{limits-section-descending-relative} we show
that, if $S = \lim_i S_i$ is a limit of affine schemes,
any scheme $X$ of finite presentation over $S$ descends to a scheme
$X_i$ over $S_i$ for some $i$.

\begin{lemma}
\label{lemma-locally-finite-presentation-characterize}
Let $f : X \to S$ be a morphism of schemes.
The following are equivalent
\begin{enumerate}
\item The morphism $f$ is locally of finite presentation.
\item For every affine opens $U \subset X$, $V \subset S$
with $f(U) \subset V$ the ring map
$\mathcal{O}_S(V) \to \mathcal{O}_X(U)$ is of finite presentation.
\item There exist an open covering $S = \bigcup_{j \in J} V_j$
and open coverings $f^{-1}(V_j) = \bigcup_{i \in I_j} U_i$ such
that each of the morphisms $U_i \to V_j$, $j\in J, i\in I_j$
is locally of finite presentation.
\item There exist an affine open covering $S = \bigcup_{j \in J} V_j$
and affine open coverings $f^{-1}(V_j) = \bigcup_{i \in I_j} U_i$ such
that the ring map $\mathcal{O}_S(V_j) \to \mathcal{O}_X(U_i)$ is
of finite presentation, for all $j\in J, i\in I_j$.
\end{enumerate}
Moreover, if $f$ is locally of finite presentation then for
any open subschemes $U \subset X$, $V \subset S$ with $f(U) \subset V$
the restriction $f|_U : U \to V$ is locally of finite presentation.
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-locally-P-characterize} if we show that
the property ``$R \to A$ is of finite presentation'' is local.
We check conditions (a), (b) and (c) of Definition
\ref{definition-property-local}.
By Algebra, Lemma \ref{algebra-lemma-base-change-finiteness}
being of finite presentation is stable under base change and hence
we conclude (a) holds. By Algebra, Lemma
\ref{algebra-lemma-compose-finite-type} being of finite presentation
is stable under composition and trivially for any ring
$R$ the ring map $R \to R_f$ is of finite presentation.
We conclude (b) holds. Finally, property (c) is true
according to Algebra, Lemma \ref{algebra-lemma-cover-upstairs}.
\end{proof}

\begin{lemma}
\label{lemma-composition-finite-presentation}
The composition of two morphisms which are locally of finite presentation is
locally of finite presentation.
The same is true for morphisms of finite presentation.
\end{lemma}

\begin{proof}
In the proof of Lemma \ref{lemma-locally-finite-presentation-characterize}
we saw that being of finite presentation is a local property of ring maps.
Hence the first statement of the lemma follows from
Lemma \ref{lemma-composition-type-P} combined
with the fact that being of finite presentation
is a property of ring maps that is
stable under composition, see
Algebra, Lemma \ref{algebra-lemma-compose-finite-type}.
By the above and the fact that compositions of
quasi-compact, quasi-separated morphisms are
quasi-compact and quasi-separated, see
Schemes, Lemmas \ref{schemes-lemma-composition-quasi-compact}
and \ref{schemes-lemma-separated-permanence}
we see that the composition of morphisms of finite presentation is
of finite presentation.
\end{proof}

\begin{lemma}
\label{lemma-base-change-finite-presentation}
The base change of a morphism which is locally of finite presentation
is locally of finite presentation. The same is true for morphisms of
finite presentation.
\end{lemma}

\begin{proof}
In the proof of Lemma \ref{lemma-locally-finite-presentation-characterize}
we saw that being of finite presentation is a local property of ring maps.
Hence the first statement of the lemma follows from
Lemma \ref{lemma-composition-type-P} combined
with the fact that being of finite presentation
is a property of ring maps that is
stable under base change, see
Algebra, Lemma \ref{algebra-lemma-base-change-finiteness}.
By the above and the fact that a base change of a
quasi-compact, quasi-separated morphism is quasi-compact
and quasi-separated, see
Schemes, Lemmas \ref{schemes-lemma-quasi-compact-preserved-base-change}
and \ref{schemes-lemma-separated-permanence}
we see that the base change of a morphism of finite presentation is
a morphism of finite presentation.
\end{proof}

\begin{lemma}
\label{lemma-open-immersion-locally-finite-presentation}
Any open immersion is locally of finite presentation.
\end{lemma}

\begin{proof}
This is true because an open immersion is a local isomorphism.
\end{proof}

\begin{lemma}
\label{lemma-quasi-compact-open-immersion-finite-presentation}
Any open immersion is of finite presentation if and only if
it is quasi-compact.
\end{lemma}

\begin{proof}
We have seen (Lemma \ref{lemma-open-immersion-locally-finite-presentation})
that an open immersion is locally of finite presentation.
We have seen (Schemes, Lemma \ref{schemes-lemma-immersions-monomorphisms})
that an immersion is separated and hence quasi-separated. From this
and Definition \ref{definition-finite-presentation} the lemma follows.
\end{proof}

\begin{lemma}
\label{lemma-closed-immersion-finite-presentation}
\begin{slogan}
Closed immersions of finite presentation correspond
to quasi-coherent sheaves of ideals of finite type.
\end{slogan}
A closed immersion $i : Z \to X$ is of finite presentation if and only if
the associated quasi-coherent sheaf of ideals
$\mathcal{I} = \Ker(\mathcal{O}_X \to i_*\mathcal{O}_Z)$
is of finite type (as an $\mathcal{O}_X$-module).
\end{lemma}

\begin{proof}
On any affine open $\Spec(R) \subset X$ we have
$i^{-1}(\Spec(R)) = \Spec(R/I)$ and
$\mathcal{I} = \widetilde{I}$. Moreover, $\mathcal{I}$
is of finite type if and only if $I$ is a finite $R$-module
for every such affine open (see
Properties, Lemma \ref{properties-lemma-finite-type-module}).
And $R/I$ is of finite presentation
over $R$ if and only if $I$ is a finite $R$-module. Hence we win.
\end{proof}

\begin{lemma}
\label{lemma-finite-presentation-finite-type}
A morphism which is locally of finite presentation is locally of finite type.
A morphism of finite presentation is of finite type.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-noetherian-finite-type-finite-presentation}
\begin{slogan}
Over a locally Noetherian base, finite type is finite presentation.
\end{slogan}
Let $f : X \to S$ be a morphism.
\begin{enumerate}
\item If $S$ is locally Noetherian and $f$ locally of finite type
then $f$ is locally of finite presentation.
\item If $S$ is locally Noetherian and $f$ of finite type
then $f$ is of finite presentation.
\end{enumerate}
\end{lemma}

\begin{proof}
The first statement follows from the fact that a ring
of finite type over a Noetherian ring is of finite presentation, see Algebra,
Lemma \ref{algebra-lemma-Noetherian-finite-type-is-finite-presentation}.
Suppose that $f$ is of finite type and $S$ is locally Noetherian.
Then $f$ is quasi-compact and locally of finite presentation by (1).
Hence it suffices to prove that $f$ is quasi-separated.
This follows from Lemma \ref{lemma-finite-type-Noetherian-quasi-separated}
(and Lemma \ref{lemma-finite-presentation-finite-type}).
\end{proof}

\begin{lemma}
\label{lemma-finite-presentation-quasi-compact-quasi-separated}
Let $S$ be a scheme which is quasi-compact and quasi-separated.
If $X$ is of finite presentation over $S$, then $X$ is quasi-compact
and quasi-separated.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-finite-presentation-permanence}
Let $f : X \to Y$ be a morphism of schemes over $S$.
\begin{enumerate}
\item If $X$ is locally of finite presentation over $S$ and
$Y$ is locally of finite type over $S$, then $f$ is locally
of finite presentation.
\item If $X$ is of finite presentation over $S$ and $Y$ is quasi-separated
and locally of finite type over $S$, then $f$ is of finite presentation.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). Via Lemma \ref{lemma-locally-finite-presentation-characterize}
this translates into the following algebra
fact: Given ring maps $A \to B \to C$ such that $A \to C$ is
of finite presentation and $A \to B$ is of finite type,
then $B \to C$ is of finite presentation. See
Algebra, Lemma \ref{algebra-lemma-compose-finite-type}.

\medskip\noindent
Part (2) follows from (1) and
Schemes, Lemmas \ref{schemes-lemma-compose-after-separated} and
\ref{schemes-lemma-quasi-compact-permanence}.
\end{proof}

\begin{lemma}
\label{lemma-diagonal-morphism-finite-type}
Let $f : X \to Y$ be a morphism of schemes with diagonal
$\Delta : X \to X \times_Y X$. If $f$ is locally of finite type
then $\Delta$ is locally of finite presentation. If $f$ is quasi-separated
and locally of finite type, then $\Delta$ is of finite presentation.
\end{lemma}

\begin{proof}
Note that $\Delta$ is a morphism of schemes over $X$ (via the second
projection $X \times_Y X \to X$). Assume $f$ is locally of finite type.
Note that $X$ is of finite presentation over $X$ and $X \times_Y X$ is
locally of finite type over $X$ (by Lemma \ref{lemma-base-change-finite-type}).
Thus the first statement holds by
Lemma \ref{lemma-finite-presentation-permanence}.
The second statement follows from the first, the definitions, and
the fact that a diagonal morphism is a monomorphism, hence separated
(Schemes, Lemma \ref{schemes-lemma-monomorphism-separated}).
\end{proof}








\section{Constructible sets}
\label{section-constructible}

\noindent
Constructible and locally constructible sets of schemes have been discussed in
Properties, Section \ref{properties-section-constructible}.
In this section we prove some results concerning images and inverse images
of (locally) constructible sets. The main result is Chevalley's theorem
which states that the image of a locally constructible set under a morphism
of finite presentation is locally constructible.

\begin{lemma}
\label{lemma-inverse-image-constructible}
Let $f : X \to Y$ be a morphism of schemes.
Let $E \subset Y$ be a subset.
If $E$ is (locally) constructible in $Y$, then $f^{-1}(E)$ is (locally)
constructible in $X$.
\end{lemma}

\begin{proof}
To show that the inverse image of every constructible subset is constructible
it suffices to show that the inverse image of every retrocompact open $V$
of $Y$ is retrocompact in $X$, see
Topology, Lemma \ref{topology-lemma-inverse-images-constructibles}.
The significance of $V$ being retrocompact
in $Y$ is just that the open immersion $V \to Y$ is quasi-compact.
Hence the base change $f^{-1}(V) = X \times_Y V \to X$ is quasi-compact
too, see
Schemes, Lemma \ref{schemes-lemma-quasi-compact-preserved-base-change}.
Hence we see $f^{-1}(V)$ is retrocompact in $X$.
Suppose $E$ is locally constructible in $Y$.
Choose $x \in X$. Choose an affine neighbourhood $V$ of $f(x)$ and
an affine neighbourhood $U \subset X$ of $x$ such that $f(U) \subset V$.
Thus we think of $f|_U : U \to V$ as a morphism into $V$. By
Properties, Lemma \ref{properties-lemma-locally-constructible}
we see that $E \cap V$ is constructible in $V$. By the constructible case
we see that $(f|_U)^{-1}(E \cap V)$ is constructible in $U$.
Since $(f|_U)^{-1}(E \cap V) = f^{-1}(E) \cap U$ we win.
\end{proof}

\begin{lemma}
\label{lemma-chevalley}
Let $f : X \to Y$ be a morphism of schemes.
Assume
\begin{enumerate}
\item $f$ is quasi-compact and locally of finite presentation, and
\item $Y$ is quasi-compact and quasi-separated.
\end{enumerate}
Then the image of every constructible subset of $X$ is constructible in $Y$.
\end{lemma}

\begin{proof}
By
Properties,
Lemma \ref{properties-lemma-constructible-quasi-compact-quasi-separated}
it suffices to prove this lemma in case $Y$ is affine.
In this case $X$ is quasi-compact. Hence we can write
$X = U_1 \cup \ldots \cup U_n$ with each $U_i$ affine open in $X$.
If $E \subset X$ is constructible, then each $E \cap U_i$ is constructible
too, see
Topology,
Lemma \ref{topology-lemma-open-immersion-constructible-inverse-image}.
Hence, since $f(E) = \bigcup f(E \cap U_i)$ and since finite unions of
constructible sets are constructible, this reduces us to the case where
$X$ is affine. In this case the result is
Algebra, Theorem \ref{algebra-theorem-chevalley}.
\end{proof}

\begin{theorem}[Chevalley's Theorem]
\label{theorem-chevalley}
\begin{reference}
\cite[IV, Theorem 1.8.4]{EGA}
\end{reference}
Let $f : X \to Y$ be a morphism of schemes.
Assume $f$ is quasi-compact and locally of finite presentation.
Then the image of every locally constructible subset is locally constructible.
\end{theorem}

\begin{proof}
Let $E \subset X$ be locally constructible.
We have to show that $f(E)$ is locally constructible too.
We will show that $f(E) \cap V$ is constructible for any affine
open $V \subset Y$. Thus we reduce to the case where $Y$ is affine.
In this case $X$ is quasi-compact. Hence we can write
$X = U_1 \cup \ldots \cup U_n$ with each $U_i$ affine open in $X$.
If $E \subset X$ is locally constructible, then each $E \cap U_i$
is constructible, see
Properties, Lemma \ref{properties-lemma-locally-constructible}.
Hence, since $f(E) = \bigcup f(E \cap U_i)$ and since finite unions of
constructible sets are constructible, this reduces us to the case where $X$
is affine. In this case the result is
Algebra, Theorem \ref{algebra-theorem-chevalley}.
\end{proof}

\begin{lemma}
\label{lemma-constructible-containing-open}
Let $X$ be a scheme. Let $x \in X$. Let $E \subset X$ be a locally
constructible subset. If $\{x' \mid x' \leadsto x\} \subset E$,
then $E$ contains an open neighbourhood of $x$.
\end{lemma}

\begin{proof}
Assume $\{x' \mid x' \leadsto x\} \subset E$.
We may assume $X$ is affine.
In this case $E$ is constructible, see
Properties, Lemma \ref{properties-lemma-locally-constructible}.
In particular, also the complement $E^c$ is constructible. By
Algebra, Lemma \ref{algebra-lemma-constructible-is-image}
we can find a morphism of affine schemes $f : Y \to X$ such that
$E^c = f(Y)$. Let $Z \subset X$ be the scheme theoretic image of $f$. By
Lemma \ref{lemma-reach-points-scheme-theoretic-image}
and the assumption $\{x' \mid x' \leadsto x\} \subset E$
we see that $x \not \in Z$. Hence $X \setminus Z \subset E$ is an
open neighbourhood of $x$ contained in $E$.
\end{proof}




\section{Open morphisms}
\label{section-open}

\begin{definition}
\label{definition-open}
Let $f : X \to S$ be a morphism.
\begin{enumerate}
\item We say $f$ is {\it open} if the map on underlying
topological spaces is open.
\item We say $f$ is {\it universally open} if for any morphism of
schemes $S' \to S$ the base change $f' : X_{S'} \to S'$ is open.
\end{enumerate}
\end{definition}

\noindent
According to
Topology, Lemma \ref{topology-lemma-closed-open-map-specialization}
generalizations lift along certain types of open maps of topological
spaces. In fact generalizations lift along any open morphism of schemes
(see
Lemma \ref{lemma-open-generizing}).
Also, we will see that generalizations lift along flat morphisms
of schemes (Lemma \ref{lemma-generalizations-lift-flat}).
This sometimes in turn implies that the morphism is open.

\begin{lemma}
\label{lemma-locally-finite-presentation-universally-open}
Let $f : X \to S$ be a morphism.
\begin{enumerate}
\item If $f$ is locally of finite presentation and generalizations lift
along $f$, then $f$ is open.
\item If $f$ is locally of finite presentation and generalizations lift
along every base change of $f$, then $f$ is universally open.
\end{enumerate}
\end{lemma}

\begin{proof}
It suffices to prove the first assertion.
This reduces to the case where both $X$ and $S$ are affine.
In this case the result follows from
Algebra, Lemma \ref{algebra-lemma-going-up-down-specialization}
and Proposition \ref{algebra-proposition-fppf-open}.
\end{proof}

\noindent
See also Lemma \ref{lemma-fppf-open} for the case of a morphism
flat of finite presentation.

\begin{lemma}
\label{lemma-composition-open}
A composition of (universally) open morphisms is (universally) open.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-scheme-over-field-universally-open}
Let $k$ be a field. Let $X$ be a scheme over $k$.
The structure morphism $X \to \Spec(k)$ is universally open.
\end{lemma}

\begin{proof}
Let $S \to \Spec(k)$ be a morphism.
We have to show that the base change $X_S \to S$ is open.
The question is local on $S$ and $X$, hence we may assume that
$S$ and $X$ are affine. In this case the result is
Algebra, Lemma \ref{algebra-lemma-map-into-tensor-algebra-open}.
\end{proof}

\begin{lemma}
\label{lemma-open-generizing}
\begin{reference}
Follows from the implication (a) $\Rightarrow$ (b) in
\cite[IV, Corollary 1.10.4]{EGA}
\end{reference}
Let $\varphi : X \to Y$ be a morphism of schemes.
If $\varphi$ is open, then $\varphi$ is generizing
(i.e., generalizations lift along $\varphi$).
If $\varphi$ is universally open, then $\varphi$ is
universally generizing.
\end{lemma}

\begin{proof}
Assume $\varphi$ is open.
Let $y' \leadsto y$ be a specialization of points of $Y$.
Let $x \in X$ with $\varphi(x) = y$.
Choose affine opens $U \subset X$ and $V \subset Y$ such that
$\varphi(U) \subset V$ and $x \in U$. Then also $y' \in V$. Hence we
may replace $X$ by $U$ and $Y$ by $V$ and assume $X$, $Y$ affine.
The affine case is
Algebra, Lemma \ref{algebra-lemma-open-going-down}
(combined with
Algebra, Lemma \ref{algebra-lemma-going-up-down-specialization}).
\end{proof}

\begin{lemma}
\label{lemma-descent-quasi-compact}
Let $f : X \to Y$ be a morphism of schemes.
Let $g : Y' \to Y$ be open and surjective such that the base change
$f' : X' \to Y'$ is quasi-compact. Then $f$ is quasi-compact.
\end{lemma}

\begin{proof}
Let $V \subset Y$ be a quasi-compact open. As $g$ is open and surjective
we can find a quasi-compact open $W' \subset W$ such that $g(W') = V$.
By assumption $(f')^{-1}(W')$ is quasi-compact. The image of
$(f')^{-1}(W')$ in $X$ is equal to $f^{-1}(V)$, see
Lemma \ref{lemma-when-point-maps-to-pair}.
Hence $f^{-1}(V)$ is quasi-compact as the image of a quasi-compact space, see
Topology, Lemma \ref{topology-lemma-image-quasi-compact}.
Thus $f$ is quasi-compact.
\end{proof}





\section{Submersive morphisms}
\label{section-submersive}

\begin{definition}
\label{definition-submersive}
Let $f : X \to Y$ be a morphism of schemes.
\begin{enumerate}
\item We say $f$ is {\it submersive}\footnote{This is very different
from the notion of a submersion of differential manifolds.}
if the continuous map of underlying topological spaces is submersive, see
Topology, Definition \ref{topology-definition-submersive}.
\item We say $f$ is {\it universally submersive} if for every
morphism of schemes $Y' \to Y$ the base change
$Y' \times_Y X \to Y'$ is submersive.
\end{enumerate}
\end{definition}

\noindent
We note that a submersive morphism is in particular surjective.

\begin{lemma}
\label{lemma-base-change-universally-submersive}
The base change of a universally submersive morphism of schemes
by any morphism of schemes is universally submersive.
\end{lemma}

\begin{proof}
This is immediate from the definition.
\end{proof}

\begin{lemma}
\label{lemma-composition-universally-submersive}
The composition of a pair of (universally) submersive morphisms of
schemes is (universally) submersive.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}










\section{Flat morphisms}
\label{section-flat}

\noindent
Flatness is one of the most important technical tools in algebraic geometry.
In this section we introduce this notion. We intentionally limit the discussion
to straightforward observations, apart from Lemma \ref{lemma-fppf-open}.
A very important class of results, namely criteria for flatness, are
discussed in
Algebra, Sections \ref{algebra-section-criteria-flatness},
\ref{algebra-section-flatness-artinian},
\ref{algebra-section-more-flatness-criteria}, and
More on Morphisms, Section
\ref{more-morphisms-section-criterion-flat-fibres}.
There is a chapter dedicated to advanced material on flat morphisms of
schemes, namely More on Flatness, Section \ref{flat-section-introduction}.

\medskip\noindent
Recall that a module $M$ over a ring $R$ is {\it flat} if the functor
$-\otimes_R M : \text{Mod}_R \to \text{Mod}_R$ is exact. A ring map
$R \to A$ is said to be {\it flat} if $A$ is flat as an $R$-module.
See
Algebra, Definition \ref{algebra-definition-flat}.

\begin{definition}
\label{definition-flat}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent sheaf of $\mathcal{O}_X$-modules.
\begin{enumerate}
\item We say $f$ is {\it flat at a point $x \in X$} if the
local ring $\mathcal{O}_{X, x}$ is flat over the local ring
$\mathcal{O}_{S, f(x)}$.
\item We say that $\mathcal{F}$ is {\it flat over $S$ at a point $x \in X$}
if the stalk $\mathcal{F}_x$ is a flat $\mathcal{O}_{S, f(x)}$-module.
\item We say $f$ is {\it flat} if $f$ is flat at every point of $X$.
\item We say that $\mathcal{F}$ is {\it flat over $S$} if
$\mathcal{F}$ is flat over $S$ at every point $x$ of $X$.
\end{enumerate}
\end{definition}

\noindent
Thus we see that $f$ is flat if and only if
the structure sheaf $\mathcal{O}_X$ is flat over $S$.

\begin{lemma}
\label{lemma-flat-module-characterize}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent sheaf of $\mathcal{O}_X$-modules.
The following are equivalent
\begin{enumerate}
\item The sheaf $\mathcal{F}$ is flat over $S$.
\item For every affine opens $U \subset X$, $V \subset S$
with $f(U) \subset V$ the $\mathcal{O}_S(V)$-module $\mathcal{F}(U)$ is flat.
\item There exists an open covering $S = \bigcup_{j \in J} V_j$
and open coverings $f^{-1}(V_j) = \bigcup_{i \in I_j} U_i$ such
that each of the modules $\mathcal{F}|_{U_i}$ is
flat over $V_j$, for all $j\in J, i\in I_j$.
\item There exists an affine open covering $S = \bigcup_{j \in J} V_j$
and affine open coverings $f^{-1}(V_j) = \bigcup_{i \in I_j} U_i$ such
that $\mathcal{F}(U_i)$ is a flat $\mathcal{O}_S(V_j)$-module, for all
$j\in J, i\in I_j$.
\end{enumerate}
Moreover, if $\mathcal{F}$ is flat over $S$ then for
any open subschemes $U \subset X$, $V \subset S$ with $f(U) \subset V$
the restriction $\mathcal{F}|_U$ is flat over $V$.
\end{lemma}

\begin{proof}
Let $R \to A$ be a ring map. Let $M$ be an $A$-module.
If $M$ is $R$-flat, then for all primes
$\mathfrak q$ the module $M_{\mathfrak q}$ is flat over $R_{\mathfrak p}$
with $\mathfrak p$ the prime of $R$ lying under $\mathfrak q$. Conversely, if
$M_{\mathfrak q}$ is flat over $R_{\mathfrak p}$ for all primes $\mathfrak q$
of $A$, then $M$ is flat over $R$. See
Algebra, Lemma \ref{algebra-lemma-flat-localization}.
This equivalence easily implies the statements of the lemma.
\end{proof}

\begin{lemma}
\label{lemma-flat-characterize}
Let $f : X \to S$ be a morphism of schemes.
The following are equivalent
\begin{enumerate}
\item The morphism $f$ is flat.
\item For every affine opens $U \subset X$, $V \subset S$
with $f(U) \subset V$ the ring map
$\mathcal{O}_S(V) \to \mathcal{O}_X(U)$ is flat.
\item There exists an open covering $S = \bigcup_{j \in J} V_j$
and open coverings $f^{-1}(V_j) = \bigcup_{i \in I_j} U_i$ such
that each of the morphisms $U_i \to V_j$, $j\in J, i\in I_j$
is flat.
\item There exists an affine open covering $S = \bigcup_{j \in J} V_j$
and affine open coverings $f^{-1}(V_j) = \bigcup_{i \in I_j} U_i$ such
that $\mathcal{O}_S(V_j) \to \mathcal{O}_X(U_i)$ is flat, for all
$j\in J, i\in I_j$.
\end{enumerate}
Moreover, if $f$ is flat then for
any open subschemes $U \subset X$, $V \subset S$ with $f(U) \subset V$
the restriction $f|_U : U \to V$ is flat.
\end{lemma}

\begin{proof}
This is a special case of Lemma \ref{lemma-flat-module-characterize}
above.
\end{proof}

\begin{lemma}
\label{lemma-pushforward-flat-affine}
Let $f : X \to Y$ be an affine morphism of schemes over a base scheme $S$.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module.
Then $\mathcal{F}$ is flat over $S$ if and only if
$f_*\mathcal{F}$ is flat over $S$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-flat-module-characterize} and the fact that
$f$ is an affine morphism, this reduces us to the affine case.
Say $X \to Y \to S$ corresponds to the ring maps $C \leftarrow B \leftarrow A$.
Let $N$ be the $C$-module corresponding to $\mathcal{F}$.
Recall that $f_*\mathcal{F}$ corresponds to $N$ viewed as a $B$-module, see
Schemes, Lemma \ref{schemes-lemma-widetilde-pullback}.
Thus the result is clear.
\end{proof}

\begin{lemma}
\label{lemma-composition-module-flat}
Let $X \to Y \to Z$ be morphisms of schemes. Let $\mathcal{F}$ be a
quasi-coherent $\mathcal{O}_X$-module. Let $x \in X$ with image $y$ in $Y$.
If $\mathcal{F}$ is flat over $Y$ at $x$, and $Y$ is flat over $Z$ at
$y$, then $\mathcal{F}$ is flat over $Z$ at $x$.
\end{lemma}

\begin{proof}
See Algebra, Lemma \ref{algebra-lemma-composition-flat}.
\end{proof}

\begin{lemma}
\label{lemma-composition-flat}
The composition of flat morphisms is flat.
\end{lemma}

\begin{proof}
This is a special case of Lemma \ref{lemma-composition-module-flat}.
\end{proof}

\begin{lemma}
\label{lemma-base-change-module-flat}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent sheaf of $\mathcal{O}_X$-modules.
Let $g : S' \to S$ be a morphism of schemes.
Denote $g' : X' = X_{S'} \to X$ the projection.
Let $x' \in X'$ be a point with image $x = g'(x') \in X$.
If $\mathcal{F}$ is flat over $S$ at $x$, then
$(g')^*\mathcal{F}$ is flat over $S'$ at $x'$.
In particular, if $\mathcal{F}$ is flat over $S$, then
$(g')^*\mathcal{F}$ is flat over $S'$.
\end{lemma}

\begin{proof}
See Algebra, Lemma \ref{algebra-lemma-flat-base-change}.
\end{proof}

\begin{lemma}
\label{lemma-base-change-flat}
The base change of a flat morphism is flat.
\end{lemma}

\begin{proof}
This is a special case of Lemma \ref{lemma-base-change-module-flat}.
\end{proof}

\begin{lemma}
\label{lemma-generalizations-lift-flat}
Let $f : X \to S$ be a flat morphism of schemes.
Then generalizations lift along $f$, see
Topology, Definition \ref{topology-definition-lift-specializations}.
\end{lemma}

\begin{proof}
See Algebra, Section \ref{algebra-section-going-up}.
\end{proof}

\begin{lemma}
\label{lemma-fppf-open}
A flat morphism locally of finite presentation is universally open.
\end{lemma}

\begin{proof}
This follows from Lemmas \ref{lemma-generalizations-lift-flat} and
Lemma \ref{lemma-locally-finite-presentation-universally-open} above.
We can also argue directly as follows.

\medskip\noindent
Let $f : X \to S$ be flat and locally of finite presentation.
By Lemmas \ref{lemma-base-change-flat} and
\ref{lemma-base-change-finite-presentation} any base change of $f$ is flat
and locally of finite presentation. Hence it suffices to show $f$ is open.
To show $f$ is open it suffices to show that we may cover
$X$ by open affines $X = \bigcup U_i$ such that $U_i \to S$
is open. We may cover $X$ by affine opens $U_i \subset X$ such that each
$U_i$ maps into an affine open $V_i \subset S$ and such that
the induced ring map $\mathcal{O}_S(V_i) \to \mathcal{O}_X(U_i)$ is
flat and of finite presentation (Lemmas \ref{lemma-flat-characterize} and
\ref{lemma-locally-finite-presentation-characterize}).
Then $U_i \to V_i$ is open by
Algebra, Proposition \ref{algebra-proposition-fppf-open}
and the proof is complete.
\end{proof}

\begin{lemma}
\label{lemma-pf-flat-module-open}
Let $f : X \to Y$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module.
Assume $f$ locally finite presentation, $\mathcal{F}$ of
finite type, $X = \text{Supp}(\mathcal{F})$, and
$\mathcal{F}$ flat over $Y$. Then $f$ is universally open.
\end{lemma}

\begin{proof}
By Lemmas \ref{lemma-base-change-module-flat},
\ref{lemma-base-change-finite-presentation}, and
\ref{lemma-support-finite-type}
the assumptions are preserved under base change.
By Lemma \ref{lemma-locally-finite-presentation-universally-open}
it suffices to show that generalizations lift along $f$.
This follows from Algebra, Lemma \ref{algebra-lemma-going-down-flat-module}.
\end{proof}

\begin{lemma}
\label{lemma-fpqc-quotient-topology}
\begin{reference}
\cite[Expose VIII, Corollaire 4.3]{SGA1} and
\cite[IV, Corollaire 2.3.12]{EGA}
\end{reference}
Let $f : X \to Y$ be a quasi-compact, surjective, flat morphism.
A subset $T \subset Y$ is open (resp.\ closed) if and only
$f^{-1}(T)$ is open (resp.\ closed). In other words, $f$ is
a submersive morphism.
\end{lemma}

\begin{proof}
The question is local on $Y$, hence we may assume that $Y$ is affine.
In this case $X$ is quasi-compact as $f$ is quasi-compact.
Write $X = X_1 \cup \ldots \cup X_n$ as a finite union of affine opens.
Then $f' : X' = X_1 \amalg \ldots \amalg X_n \to Y$ is a surjective
flat morphism of affine schemes. Note that for $T \subset Y$ we have
$(f')^{-1}(T) = f^{-1}(T) \cap X_1 \amalg \ldots \amalg f^{-1}(T) \cap X_n$.
Hence, $f^{-1}(T)$ is open if and only if $(f')^{-1}(T)$ is open.
Thus we may assume both $X$ and $Y$ are affine.

\medskip\noindent
Let $f : \Spec(B) \to \Spec(A)$ be a surjective morphism of affine schemes
corresponding to a flat ring map $A \to B$. Suppose that $f^{-1}(T)$ is
closed, say $f^{-1}(T) = V(J)$ for $J \subset B$ an ideal. Then
$T = f(f^{-1}(T)) = f(V(J))$ is the image of $\Spec(B/J) \to \Spec(A)$
(here we use that $f$ is surjective). On the other hand, generalizations
lift along $f$ (Lemma \ref{lemma-generalizations-lift-flat}).
Hence by Topology, Lemma \ref{topology-lemma-lift-specializations-images}
we see that $Y \setminus T = f(X \setminus f^{-1}(T))$ is stable under
generalization. Hence $T$ is stable under specialization
(Topology, Lemma \ref{topology-lemma-open-closed-specialization}).
Thus $T$ is closed by
Algebra, Lemma \ref{algebra-lemma-image-stable-specialization-closed}.
\end{proof}

\begin{lemma}
\label{lemma-flat-permanence}
Let $h : X \to Y$ be a morphism of schemes over $S$.
Let $\mathcal{G}$ be a quasi-coherent sheaf on $Y$.
Let $x \in X$ with $y = h(x) \in Y$. If $h$ is flat at $x$, then
$$
\mathcal{G}\text{ flat over }S\text{ at }y
\Leftrightarrow
h^*\mathcal{G}\text{ flat over }S\text{ at }x.
$$
In particular: If $h$ is surjective and flat, then
$\mathcal{G}$ is flat over $S$, if and only if
$h^*\mathcal{G}$ is flat over $S$. If $h$ is surjective and
flat, and $X$ is flat over $S$, then $Y$ is flat over $S$.
\end{lemma}

\begin{proof}
You can prove this by applying
Algebra, Lemma \ref{algebra-lemma-flatness-descends-more-general}.
Here is a direct proof. Let $s \in S$ be the image of $y$.
Consider the local ring maps
$\mathcal{O}_{S, s} \to \mathcal{O}_{Y, y} \to \mathcal{O}_{X, x}$.
By assumption the ring map $\mathcal{O}_{Y, y} \to \mathcal{O}_{X, x}$
is faithfully flat, see
Algebra, Lemma \ref{algebra-lemma-local-flat-ff}.
Let $N = \mathcal{G}_y$. Note that
$h^*\mathcal{G}_x = N \otimes_{\mathcal{O}_{Y, y}} \mathcal{O}_{X, x}$, see
Sheaves, Lemma \ref{sheaves-lemma-stalk-pullback-modules}.
Let $M' \to M$ be an injection of $\mathcal{O}_{S, s}$-modules.
By the faithful flatness mentioned above we have
\begin{align*}
\Ker(
M' \otimes_{\mathcal{O}_{S, s}} N \to M \otimes_{\mathcal{O}_{S, s}} N)
\otimes_{\mathcal{O}_{Y, y}} \mathcal{O}_{X, x} \\
=
\Ker(
M' \otimes_{\mathcal{O}_{S, s}} N
\otimes_{\mathcal{O}_{Y, y}} \mathcal{O}_{X, x}
\to
M \otimes_{\mathcal{O}_{S, s}} N
\otimes_{\mathcal{O}_{Y, y}} \mathcal{O}_{X, x})
\end{align*}
Hence the equivalence of the lemma follows from the second characterization
of flatness in
Algebra, Lemma \ref{algebra-lemma-flat}.
\end{proof}

\begin{lemma}
\label{lemma-flat-pullback-support}
Let $f : Y \to X$ be a morphism of schemes. Let $\mathcal{F}$ be
a finite type quasi-coherent $\mathcal{O}_X$-module with scheme
theoretic support $Z \subset X$. If $f$ is flat,
then $f^{-1}(Z)$ is the scheme theoretic support of $f^*\mathcal{F}$.
\end{lemma}

\begin{proof}
Using the characterization of scheme theoretic support on affines
as given in Lemma \ref{lemma-scheme-theoretic-support} we reduce to
Algebra, Lemma \ref{algebra-lemma-annihilator-flat-base-change}.
\end{proof}

\begin{lemma}
\label{lemma-flat-morphism-scheme-theoretically-dense-open}
Let $f : X \to Y$ be a flat morphism of schemes. Let $V \subset Y$ be
a retrocompact open which is scheme theoretically dense. Then $f^{-1}V$
is scheme theoretically dense in $X$.
\end{lemma}

\begin{proof}
We will use the characterization of
Lemma \ref{lemma-characterize-scheme-theoretically-dense}.
We have to show that for any open $U \subset X$ the map
$\mathcal{O}_X(U) \to \mathcal{O}_X(U \cap f^{-1}V)$ is injective.
It suffices to prove this when $U$ is an affine open which maps into
an affine open $W \subset Y$. Say $W = \Spec(A)$ and $U = \Spec(B)$.
Then $V \cap W = D(f_1) \cup \ldots \cup D(f_n)$ for some
$f_i \in A$, see
Algebra, Lemma \ref{algebra-lemma-qc-open}.
Thus we have to show that
$B \to B_{f_1} \times \ldots \times B_{f_n}$ is injective.
We are given that $A \to A_{f_1} \times \ldots \times A_{f_n}$ is injective
and that $A \to B$ is flat. Since $B_{f_i} = A_{f_i} \otimes_A B$ we win.
\end{proof}

\begin{lemma}
\label{lemma-flat-base-change-scheme-theoretic-image}
\begin{slogan}
Taking scheme theoretic images commutes with flat base change
in the quasi-compact case
\end{slogan}
Let $f : X \to Y$ be a flat morphism of schemes. Let $g : V \to Y$ be a
quasi-compact morphism of schemes. Let $Z \subset Y$ be the scheme theoretic
image of $g$ and let $Z' \subset X$ be the scheme theoretic image of the
base change $V \times_Y X \to X$. Then $Z' = f^{-1}Z$.
\end{lemma}

\begin{proof}
Recall that $Z$ is cut out by
$\mathcal{I} = \Ker(\mathcal{O}_Y \to g_*\mathcal{O}_V)$
and $Z'$ is cut out by
$\mathcal{I}' = \Ker(\mathcal{O}_X \to
(V \times_Y X \to X)_*\mathcal{O}_{V \times_Y X})$, see
Lemma \ref{lemma-quasi-compact-scheme-theoretic-image}.
Hence the question is local on $X$ and $Y$ and we may assume $X$ and $Y$
affine. Note that we may replace $V$ by $\coprod V_i$ where
$V = V_1 \cup \ldots \cup V_n$ is a finite affine open covering.
Hence we may assume $g$ is affine. In this case
$(V \times_Y X \to X)_*\mathcal{O}_{V \times_Y X}$ is the pullback
of $g_*\mathcal{O}_V$ by $f$. Since $f$ is flat we conclude that
$f^*\mathcal{I} = \mathcal{I}'$ and the lemma holds.
\end{proof}




\section{Flat closed immersions}
\label{section-flat-closed-immersions}

\noindent
Connected components of schemes are not always open. But they do always
have a canonical scheme structure. We explain this in this section.

\begin{lemma}
\label{lemma-characterize-flat-closed-immersions}
Let $X$ be a scheme. The rule which associates to a closed subscheme
of $X$ its underlying closed subset defines a bijection
$$
\left\{
\begin{matrix}
\text{closed subschemes }Z \subset X \\
\text{such that }Z \to X\text{ is flat}
\end{matrix}
\right\}
\leftrightarrow
\left\{
\begin{matrix}
\text{closed subsets }Z \subset X \\
\text{closed under generalizations}
\end{matrix}
\right\}
$$
If $Z \subset X$ is such a closed subscheme, every morphism of schemes
$g : Y \to X$ with $g(Y) \subset Z$ set theoretically factors (scheme
theoretically) through $Z$.
\end{lemma}

\begin{proof}
The affine case of the bijection is
Algebra, Lemma \ref{algebra-lemma-pure-open-closed-specializations}.
For general schemes $X$ the bijection follows by covering $X$ by affines
and glueing. Details omitted. For the final assertion, observe that the
projection $Z \times_{X, g} Y \to Y$ is a flat
(Lemma \ref{lemma-base-change-flat}) closed immersion which
is bijective on underlying topological spaces and hence must be
an isomorphism by the bijection established in the first part of the proof.
\end{proof}

\begin{lemma}
\label{lemma-flat-closed-immersions-finite-presentation}
A flat closed immersion of finite presentation
is the open immersion of an open and closed subscheme.
\end{lemma}

\begin{proof}
The affine case is
Algebra, Lemma \ref{algebra-lemma-finitely-generated-pure-ideal}.
In general the lemma follows by covering $X$ by affines.
Details omitted.
\end{proof}

\noindent
Note that a connected component $T$ of a scheme $X$ is a closed
subset stable under generalization. Hence the following definition
makes sense.

\begin{definition}
\label{definition-scheme-structure-connected-component}
Let $X$ be a scheme. Let $T \subset X$ be a connected component.
The {\it canonical scheme structure on $T$} is the unique
scheme structure on $T$ such that the closed immersion $T \to X$
is flat, see
Lemma \ref{lemma-characterize-flat-closed-immersions}.
\end{definition}

\noindent
It turns out that we can determine when every finite flat
$\mathcal{O}_X$-module is finite locally free using the previous lemma.

\begin{lemma}
\label{lemma-finite-flat-is-finite-locally-free}
Let $X$ be a scheme. The following are equivalent
\begin{enumerate}
\item every finite flat quasi-coherent $\mathcal{O}_X$-module is
finite locally free, and
\item every closed subset $Z \subset X$ which is closed under generalizations
is open.
\end{enumerate}
\end{lemma}

\begin{proof}
In the affine case this is
Algebra, Lemma \ref{algebra-lemma-finite-flat-module-finitely-presented}.
The scheme case does not follow directly from the affine case, so we
simply repeat the arguments.

\medskip\noindent
Assume (1). Consider a closed immersion $i : Z \to X$ such that $i$ is flat.
Then $i_*\mathcal{O}_Z$ is quasi-coherent and flat, hence finite locally
free by (1). Thus $Z = \text{Supp}(i_*\mathcal{O}_Z)$ is also open and we see
that (2) holds. Hence the implication (1) $\Rightarrow$ (2) follows from
the characterization of flat closed immersions in
Lemma \ref{lemma-characterize-flat-closed-immersions}.

\medskip\noindent
For the converse assume that $X$ satisfies (2).
Let $\mathcal{F}$ be a finite flat quasi-coherent $\mathcal{O}_X$-module.
The support $Z = \text{Supp}(\mathcal{F})$ of $\mathcal{F}$ is closed, see
Modules, Lemma \ref{modules-lemma-support-finite-type-closed}.
On the other hand, if $x \leadsto x'$ is a specialization, then by
Algebra, Lemma \ref{algebra-lemma-finite-flat-local}
the module $\mathcal{F}_{x'}$ is free over $\mathcal{O}_{X, x'}$, and
$$
\mathcal{F}_x =
\mathcal{F}_{x'} \otimes_{\mathcal{O}_{X, x'}} \mathcal{O}_{X, x}.
$$
Hence
$x' \in \text{Supp}(\mathcal{F}) \Rightarrow x \in \text{Supp}(\mathcal{F})$,
in other words, the support is closed under generalization.
As $X$ satisfies (2) we see that the support of $\mathcal{F}$
is open and closed. The modules $\wedge^i(\mathcal{F})$, $i = 1, 2, 3, \ldots$
are finite flat quasi-coherent $\mathcal{O}_X$-modules
also, see
Modules, Section \ref{modules-section-symmetric-exterior}.
Note that
$\text{Supp}(\wedge^{i + 1}(\mathcal{F})) \subset
\text{Supp}(\wedge^i(\mathcal{F}))$.
Thus we see that there exists a decomposition
$$
X = U_0 \amalg U_1 \amalg U_2 \amalg \ldots
$$
by open and closed subsets such that the support of
$\wedge^i(\mathcal{F})$ is $U_i \cup U_{i + 1} \cup \ldots$ for all $i$.
Let $x$ be a point of $X$, and say $x \in U_r$.
Note that
$\wedge^i(\mathcal{F})_x \otimes \kappa(x) =
\wedge^i(\mathcal{F}_x \otimes \kappa(x))$.
Hence, $x \in U_r$ implies that $\mathcal{F}_x \otimes \kappa(x)$
is a vector space of dimension $r$. By Nakayama's lemma, see
Algebra, Lemma \ref{algebra-lemma-NAK}
we can choose an affine open neighbourhood $U \subset U_r \subset X$
of $x$ and sections $s_1, \ldots, s_r \in \mathcal{F}(U)$ such that
the induced map
$$
\mathcal{O}_U^{\oplus r} \longrightarrow \mathcal{F}|_U, \quad
(f_1, \ldots, f_r) \longmapsto \sum f_i s_i
$$
is surjective. This means that
$\wedge^r(\mathcal{F}|_U)$ is a finite flat quasi-coherent
$\mathcal{O}_U$-module whose support is all of $U$.
By the above it is generated by a single element, namely
$s_1 \wedge \ldots \wedge s_r$. Hence
$\wedge^r(\mathcal{F}|_U) \cong \mathcal{O}_U/\mathcal{I}$
for some quasi-coherent sheaf of ideals $\mathcal{I}$
such that $\mathcal{O}_U/\mathcal{I}$ is flat over $\mathcal{O}_U$ and
such that $V(\mathcal{I}) = U$.
It follows that $\mathcal{I} = 0$ by applying
Lemma \ref{lemma-characterize-flat-closed-immersions}.
Thus $s_1 \wedge \ldots \wedge s_r$ is a basis for
$\wedge^r(\mathcal{F}|_U)$ and it follows that the displayed map is injective
as well as surjective. This proves that $\mathcal{F}$ is finite locally free
as desired.
\end{proof}






\section{Generic flatness}
\label{section-generic-flatness}

\noindent
A scheme of finite type over an integral base is flat over a dense
open of the base. In
Algebra, Section \ref{algebra-section-generic-flatness}
we proved a Noetherian version, a version for morphisms of finite presentation,
and a general version. We only state and prove the general version here.
However, it turns out that this will be superseded by
Proposition \ref{proposition-generic-flatness-reduced}
which shows the result holds if we only assume the base is reduced.

\begin{proposition}[Generic flatness]
\label{proposition-generic-flatness}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent sheaf of $\mathcal{O}_X$-modules.
Assume
\begin{enumerate}
\item $S$ is integral,
\item $f$ is of finite type, and
\item $\mathcal{F}$ is a finite type $\mathcal{O}_X$-module.
\end{enumerate}
Then there exists an open dense subscheme $U \subset S$ such that
$X_U \to U$ is flat and of finite presentation and such that
$\mathcal{F}|_{X_U}$ is flat over $U$ and of finite presentation
over $\mathcal{O}_{X_U}$.
\end{proposition}

\begin{proof}
As $S$ is integral it is irreducible (see
Properties, Lemma \ref{properties-lemma-characterize-integral})
and any nonempty open is dense. Hence we may replace
$S$ by an affine open of $S$ and assume that $S = \Spec(A)$ is
affine. As $S$ is integral we see that $A$ is a domain.
As $f$ is of finite type, it is quasi-compact, so $X$ is quasi-compact.
Hence we can find a finite affine open cover
$X = \bigcup_{i = 1, \ldots, n} X_i$. Write $X_i = \Spec(B_i)$.
Then $B_i$ is a finite type $A$-algebra, see
Lemma \ref{lemma-locally-finite-type-characterize}.
Moreover there are finite type
$B_i$-modules $M_i$ such that $\mathcal{F}|_{X_i}$ is the
quasi-coherent sheaf associated to the $B_i$-module $M_i$, see
Properties, Lemma \ref{properties-lemma-finite-type-module}.
Next, for each pair of indices $i, j$ choose an ideal $I_{ij} \subset B_i$
such that $X_i \setminus X_i \cap X_j = V(I_{ij})$ inside
$X_i = \Spec(B_i)$. Set $M_{ij} = B_i/I_{ij}$ and think
of it as a $B_i$-module. Then $V(I_{ij}) = \text{Supp}(M_{ij})$
and $M_{ij}$ is a finite $B_i$-module.

\medskip\noindent
At this point we apply
Algebra, Lemma \ref{algebra-lemma-generic-flatness}
the pairs $(A \to B_i, M_{ij})$ and to the
pairs $(A \to B_i, M_i)$. Thus we obtain
nonzero $f_{ij}, f_i \in A$ such that (a) $A_{f_{ij}} \to B_{i, f_{ij}}$
is flat and of finite presentation and $M_{ij, f_{ij}}$ is flat
over $A_{f_{ij}}$ and of finite presentation over $B_{i, f_{ij}}$, and
(b) $B_{i, f_i}$ is flat and of finite presentation over $A_f$ and
$M_{i, f_i}$ is flat and of finite presentation over $B_{i, f_i}$. Set
$f = (\prod f_i) (\prod f_{ij})$.
We claim that taking $U = D(f)$ works.

\medskip\noindent
To prove our claim we may replace $A$ by $A_f$, i.e.,
perform the base change by $U = \Spec(A_f) \to S$.
After this base change we see that each of $A \to B_i$ is
flat and of finite presentation and that $M_i$, $M_{ij}$ are flat over $A$
and of finite presentation over $B_i$.
This already proves that $X \to S$ is quasi-compact,
locally of finite presentation, flat, and that $\mathcal{F}$
is flat over $S$ and of finite presentation over $\mathcal{O}_X$, see
Lemma \ref{lemma-locally-finite-presentation-characterize}
and
Properties, Lemma \ref{properties-lemma-finite-presentation-module}.
Since $M_{ij}$ is of finite presentation over $B_i$ we see that
$X_i \cap X_j = X_i \setminus \text{Supp}(M_{ij})$ is a quasi-compact
open of $X_i$, see
Algebra, Lemma \ref{algebra-lemma-support-finite-presentation-constructible}.
Hence we see that $X \to S$ is quasi-separated by
Schemes, Lemma \ref{schemes-lemma-characterize-quasi-separated}.
This proves the proposition.
\end{proof}

\noindent
It actually turns out that there is also a version of generic
flatness over an arbitrary reduced base. Here it is.

\begin{proposition}[Generic flatness, reduced case]
\label{proposition-generic-flatness-reduced}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent sheaf of $\mathcal{O}_X$-modules.
Assume
\begin{enumerate}
\item $S$ is reduced,
\item $f$ is of finite type, and
\item $\mathcal{F}$ is a finite type $\mathcal{O}_X$-module.
\end{enumerate}
Then there exists an open dense subscheme $U \subset S$ such that
$X_U \to U$ is flat and of finite presentation and such that
$\mathcal{F}|_{X_U}$ is flat over $U$ and of finite presentation
over $\mathcal{O}_{X_U}$.
\end{proposition}

\begin{proof}
For the impatient reader: This proof is a repeat of the proof of
Proposition \ref{proposition-generic-flatness}
using
Algebra, Lemma \ref{algebra-lemma-generic-flatness-reduced}
instead of
Algebra, Lemma \ref{algebra-lemma-generic-flatness}.

\medskip\noindent
Since being flat and being of finite presentation is local on the
base, see
Lemmas \ref{lemma-flat-module-characterize} and
\ref{lemma-locally-finite-presentation-characterize},
we may work affine locally on $S$. Thus we may assume that
$S = \Spec(A)$, where $A$ is a reduced ring (see
Properties, Lemma \ref{properties-lemma-characterize-reduced}).
As $f$ is of finite type, it is quasi-compact, so $X$ is quasi-compact.
Hence we can find a finite affine open cover
$X = \bigcup_{i = 1, \ldots, n} X_i$. Write $X_i = \Spec(B_i)$.
Then $B_i$ is a finite type $A$-algebra, see
Lemma \ref{lemma-locally-finite-type-characterize}.
Moreover there are finite type
$B_i$-modules $M_i$ such that $\mathcal{F}|_{X_i}$ is the
quasi-coherent sheaf associated to the $B_i$-module $M_i$, see
Properties, Lemma \ref{properties-lemma-finite-type-module}.
Next, for each pair of indices $i, j$ choose an ideal $I_{ij} \subset B_i$
such that $X_i \setminus X_i \cap X_j = V(I_{ij})$ inside
$X_i = \Spec(B_i)$. Set $M_{ij} = B_i/I_{ij}$ and think
of it as a $B_i$-module. Then $V(I_{ij}) = \text{Supp}(M_{ij})$
and $M_{ij}$ is a finite $B_i$-module.

\medskip\noindent
At this point we apply
Algebra, Lemma \ref{algebra-lemma-generic-flatness-reduced} to
the pairs $(A \to B_i, M_{ij})$ and to the pairs $(A \to B_i, M_i)$.
Thus we obtain dense opens
$U(A \to B_i, M_{ij}) \subset S$ and dense opens
$U(A \to B_i, M_i) \subset S$ with notation as in
Algebra, Equation (\ref{algebra-equation-good-locus}).
Since a finite intersection of dense opens is dense open, we see that
$$
U =
\bigcap\nolimits_{i, j} U(A \to B_i, M_{ij})
\quad\cap\quad
\bigcap\nolimits_i U(A \to B_i, M_i)
$$
is open and dense in $S$. We claim that $U$ is the desired open.

\medskip\noindent
Pick $u \in U$. By definition of the loci $U(A \to B_i, M_{ij})$
and $U(A \to B, M_i)$ there exist $f_{ij}, f_i \in A$ such that
(a) $u \in D(f_i)$ and $u \in D(f_{ij})$,
(b) $A_{f_{ij}} \to B_{i, f_{ij}}$ is flat and of finite presentation
and $M_{ij, f_{ij}}$ is flat over $A_{f_{ij}}$ and of finite presentation
over $B_{i, f_{ij}}$, and
(c) $B_{i, f_i}$ is flat and of finite presentation over $A_{f_i}$ and
$M_{i, f_i}$ is of finite presentation over $B_{i, f_i}$ and flat over
$A_{f_i}$. Set
$f = (\prod f_i) (\prod f_{ij})$.
Now it suffices to prove that $X \to S$ is flat and of finite presentation
over $D(f)$ and that $\mathcal{F}$ restricted to $X_{D(f)}$ is
flat over $D(f)$ and of finite presentation over the structure sheaf
of $X_{D(f)}$.

\medskip\noindent
Hence we may replace $A$ by $A_f$, i.e.,
perform the base change by $\Spec(A_f) \to S$.
After this base change we see that each of $A \to B_i$ is
flat and of finite presentation and that $M_i$, $M_{ij}$ are flat over $A$
and of finite presentation over $B_i$.
This already proves that $X \to S$ is quasi-compact,
locally of finite presentation, flat, and that $\mathcal{F}$
is flat over $S$ and of finite presentation over $\mathcal{O}_X$, see
Lemma \ref{lemma-locally-finite-presentation-characterize}
and
Properties, Lemma \ref{properties-lemma-finite-presentation-module}.
Since $M_{ij}$ is of finite presentation over $B_i$ we see that
$X_i \cap X_j = X_i \setminus \text{Supp}(M_{ij})$ is a quasi-compact
open of $X_i$, see
Algebra, Lemma \ref{algebra-lemma-support-finite-presentation-constructible}.
Hence we see that $X \to S$ is quasi-separated by
Schemes, Lemma \ref{schemes-lemma-characterize-quasi-separated}.
This proves the proposition.
\end{proof}









\begin{remark}
\label{remark-flattening}
The results above are a first step towards more refined flattening techniques
for morphisms of schemes. The article \cite{GruRay} by Raynaud and Gruson
contains many wonderful results in this direction.
\end{remark}







\section{Morphisms and dimensions of fibres}
\label{section-dimension-fibres}

\noindent
Let $X$ be a topological space, and $x \in X$.
Recall that we have defined $\dim_x(X)$ as the minimum of the
dimensions of the open neighbourhoods of $x$ in $X$.
See Topology, Definition \ref{topology-definition-Krull}.

\begin{lemma}
\label{lemma-dimension-fibre-at-a-point}
Let $f : X \to S$ be a morphism of schemes.
Let $x \in X$ and set $s = f(x)$.
Assume $f$ is locally of finite type.
Then
$$
\dim_x(X_s) =
\dim(\mathcal{O}_{X_s, x}) + \text{trdeg}_{\kappa(s)}(\kappa(x)).
$$
\end{lemma}

\begin{proof}
This immediately reduces to the case $S = s$, and $X$ affine.
In this case the result follows from
Algebra, Lemma \ref{algebra-lemma-dimension-at-a-point-finite-type-field}.
\end{proof}

\begin{lemma}
\label{lemma-dimension-fibre-at-a-point-additive}
Let $f : X \to Y$ and $g : Y \to S$ be morphisms of schemes.
Let $x \in X$ and set $y = f(x)$, $s = g(y)$.
Assume $f$ and $g$ locally of finite type.
Then
$$
\dim_x(X_s) \leq \dim_x(X_y) + \dim_y(Y_s).
$$
Moreover, equality holds if $\mathcal{O}_{X_s, x}$ is flat
over $\mathcal{O}_{Y_s, y}$, which holds for example if $\mathcal{O}_{X, x}$
is flat over $\mathcal{O}_{Y, y}$.
\end{lemma}

\begin{proof}
Note that $\text{trdeg}_{\kappa(s)}(\kappa(x)) =
\text{trdeg}_{\kappa(y)}(\kappa(x)) + \text{trdeg}_{\kappa(s)}(\kappa(y))$.
Thus by Lemma \ref{lemma-dimension-fibre-at-a-point} the statement
is equivalent to
$$
\dim(\mathcal{O}_{X_s, x})
\leq
\dim(\mathcal{O}_{X_y, x}) + \dim(\mathcal{O}_{Y_s, y}).
$$
For this see Algebra, Lemma \ref{algebra-lemma-dimension-base-fibre-total}.
For the flat case see
Algebra, Lemma \ref{algebra-lemma-dimension-base-fibre-equals-total}.
\end{proof}

\begin{lemma}
\label{lemma-dimension-fibre-after-base-change}
Let
$$
\xymatrix{
X' \ar[r]_{g'} \ar[d]_{f'} & X \ar[d]^f \\
S' \ar[r]^g & S
}
$$
be a fibre product diagram of schemes. Assume $f$ locally of finite type.
Suppose that $x' \in X'$, $x = g'(x')$, $s' = f'(x')$ and
$s = g(s') = f(x)$. Then
\begin{enumerate}
\item $\dim_x(X_s) = \dim_{x'}(X'_{s'})$,
\item if $F$ is the fibre of the morphism $X'_{s'} \to X_s$
over $x$, then
$$
\dim(\mathcal{O}_{F, x'}) =
\dim(\mathcal{O}_{X'_{s'}, x'}) - \dim(\mathcal{O}_{X_s, x}) =
\text{trdeg}_{\kappa(s)}(\kappa(x)) -
\text{trdeg}_{\kappa(s')}(\kappa(x'))
$$
In particular $\dim(\mathcal{O}_{X'_{s'}, x'}) \geq \dim(\mathcal{O}_{X_s, x})$
and $\text{trdeg}_{\kappa(s)}(\kappa(x)) \geq
\text{trdeg}_{\kappa(s')}(\kappa(x'))$.
\item given $s', s, x$ there exists a choice of $x'$ such that
$\dim(\mathcal{O}_{X'_{s'}, x'}) = \dim(\mathcal{O}_{X_s, x})$ and
$\text{trdeg}_{\kappa(s)}(\kappa(x)) = \text{trdeg}_{\kappa(s')}(\kappa(x'))$.
\end{enumerate}
\end{lemma}

\begin{proof}
Part (1) follows immediately from
Algebra,
Lemma \ref{algebra-lemma-dimension-at-a-point-preserved-field-extension}.
Parts (2) and (3) from
Algebra, Lemma \ref{algebra-lemma-inequalities-under-field-extension}.
\end{proof}

\noindent
The following lemma follows from a nontrivial algebraic result.
Namely, the algebraic version of Zariski's main theorem.

\begin{lemma}
\label{lemma-openness-bounded-dimension-fibres}
\begin{reference}
\cite[IV Theorem 13.1.3]{EGA}
\end{reference}
Let $f : X \to S$ be a morphism of schemes.
Let $n \geq 0$. Assume $f$ is locally of finite type.
The set
$$
U_n = \{x \in X \mid \dim_x X_{f(x)} \leq n\}
$$
is open in $X$.
\end{lemma}

\begin{proof}
This is immediate from
Algebra,
Lemma \ref{algebra-lemma-dimension-fibres-bounded-open-upstairs}
\end{proof}

\begin{lemma}
\label{lemma-morphism-finite-type-bounded-dimension}
Let $f : X \to Y$ be a morphism of finite type with $Y$ quasi-compact.
Then the dimension of the fibres of $f$ is bounded.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-openness-bounded-dimension-fibres}
the set $U_n \subset X$ of points where the dimension of the fibre
is $\leq n$ is open. Since $f$ is of finite type, every point is
contained in some $U_n$ (because the dimension of a finite
type algebra over a field is finite). Since $Y$ is quasi-compact and $f$ is of
finite type, we see that $X$ is quasi-compact. Hence $X = U_n$ for
some $n$.
\end{proof}

\begin{lemma}
\label{lemma-openness-bounded-dimension-fibres-finite-presentation}
Let $f : X \to S$ be a morphism of schemes.
Let $n \geq 0$. Assume $f$ is locally of finite presentation.
The open
$$
U_n = \{x \in X \mid \dim_x X_{f(x)} \leq n\}
$$
of Lemma \ref{lemma-openness-bounded-dimension-fibres} is retrocompact
in $X$. (See Topology, Definition \ref{topology-definition-quasi-compact}.)
\end{lemma}

\begin{proof}
The topological space $X$ has a basis for its topology consisting of
affine opens $U \subset X$ such that the induced morphism
$f|_U : U \to S$ factors through an affine open $V \subset S$. Hence
it is enough to show that $U \cap U_n$ is quasi-compact for such a $U$.
Note that $U_n \cap U$ is the same as the open
$\{x \in U \mid \dim_x U_{f(x)} \leq n\}$. This reduces us to the case
where $X$ and $S$ are affine. In this case the lemma follows from
Algebra,
Lemma \ref{algebra-lemma-dimension-fibres-bounded-quasi-compact-open-upstairs}
(and Lemma \ref{lemma-locally-finite-presentation-characterize}).
\end{proof}

\begin{lemma}
\label{lemma-dimension-fibre-specialization}
Let $f : X \to S$ be a morphism of schemes.
Let $x \leadsto x'$ be a nontrivial specialization of points in $X$
lying over the same point $s \in S$. Assume $f$ is locally of finite type.
Then
\begin{enumerate}
\item $\dim_x(X_s) \leq \dim_{x'}(X_s)$,
\item $\dim(\mathcal{O}_{X_s, x}) < \dim(\mathcal{O}_{X_s, x'})$, and
\item $\text{trdeg}_{\kappa(s)}(\kappa(x)) >
\text{trdeg}_{\kappa(s)}(\kappa(x'))$.
\end{enumerate}
\end{lemma}

\begin{proof}
Part (1) follows from the fact that any open of $X_s$ containing $x'$
also contains $x$. Part (2) follows since $\mathcal{O}_{X_s, x}$ is a
localization of $\mathcal{O}_{X_s, x'}$ at a prime ideal, hence any chain
of prime ideals in $\mathcal{O}_{X_s, x}$ is part of a strictly longer
chain of primes in $\mathcal{O}_{X_s, x'}$. The last inequality follows from
Algebra, Lemma \ref{algebra-lemma-tr-deg-specialization}.
\end{proof}






\section{Morphisms of given relative dimension}
\label{section-relative-dimension}

\noindent
In order to be able to speak comfortably about morphisms of a
given relative dimension we introduce the following notion.

\begin{definition}
\label{definition-relative-dimension-d}
Let $f : X \to S$ be a morphism of schemes.
Assume $f$ is locally of finite type.
\begin{enumerate}
\item We say $f$ is of {\it relative dimension $\leq d$ at $x$} if
$\dim_x(X_{f(x)}) \leq d$.
\item We say $f$ is of {\it relative dimension $\leq d$} if
$\dim_x(X_{f(x)}) \leq d$ for all $x \in X$.
\item We say $f$ is of {\it relative dimension $d$} if
all nonempty fibres $X_s$ are equidimensional of dimension $d$.
\end{enumerate}
\end{definition}

\noindent
This is not a particularly well behaved notion, but it works well
in a number of situations.

\begin{lemma}
\label{lemma-base-change-relative-dimension-d}
Let $f : X \to S$ be a morphism of schemes which is locally of finite type.
If $f$ has relative dimension $d$, then so does any base change of $f$.
Same for relative dimension $\leq d$.
\end{lemma}

\begin{proof}
This is immediate from
Lemma \ref{lemma-dimension-fibre-after-base-change}.
\end{proof}

\begin{lemma}
\label{lemma-composition-relative-dimension-d}
Let $f : X \to Y$, $g : Y \to Z$ be locally of finite type.
If $f$ has relative dimension $\leq d$ and $g$ has relative dimension $\leq e$
then $g \circ f$ has relative dimension $\leq d + e$.
If
\begin{enumerate}
\item $f$ has relative dimension $d$,
\item $g$ has relative dimension $e$, and
\item $f$ is flat,
\end{enumerate}
then $g \circ f$ has relative dimension $d + e$.
\end{lemma}

\begin{proof}
This is immediate from Lemma \ref{lemma-dimension-fibre-at-a-point-additive}.
\end{proof}

\noindent
In general it is not possible to decompose a morphism
into its pieces where the relative dimension is a given
one. However, it is possible if the morphism has Cohen-Macaulay
fibres and is flat of finite presentation.

\begin{lemma}
\label{lemma-flat-finite-presentation-CM-fibres-relative-dimension}
\begin{slogan}
Cohen-Macaulay morphisms decompose into clopens of pure relative dimension
\end{slogan}
Let $f : X \to S$ be a morphism of schemes.
Assume that
\begin{enumerate}
\item $f$ is flat,
\item $f$ is locally of finite presentation, and
\item for all $s \in S$ the fibre $X_s$ is Cohen-Macaulay
(Properties, Definition \ref{properties-definition-Cohen-Macaulay})
\end{enumerate}
Then there exist open and closed subschemes $X_d \subset X$
such that $X = \coprod_{d \geq 0} X_d$ and $f|_{X_d} : X_d \to S$
has relative dimension $d$.
\end{lemma}

\begin{proof}
This is immediate from
Algebra, Lemma
\ref{algebra-lemma-relative-dimension-CM}.
\end{proof}

\begin{lemma}
\label{lemma-locally-quasi-finite-rel-dimension-0}
Let $f : X \to S$ be a morphism of schemes.
Assume $f$ is locally of finite type.
Let $x \in X$ with $s = f(x)$.
Then $f$ is quasi-finite at $x$ if and only if $\dim_x(X_s) = 0$.
In particular, $f$ is locally quasi-finite if and only if $f$ has relative
dimension $0$.
\end{lemma}

\begin{proof}
First proof.
If $f$ is quasi-finite at $x$ then $\kappa(x)$ is a finite extension of
$\kappa(s)$ (by
Lemma \ref{lemma-residue-field-quasi-finite})
and $x$ is isolated in $X_s$ (by
Lemma \ref{lemma-quasi-finite-at-point-characterize}),
hence $\dim_x(X_s) = 0$ by
Lemma \ref{lemma-dimension-fibre-at-a-point}.
Conversely, if $\dim_x(X_s) = 0$ then by
Lemma \ref{lemma-dimension-fibre-at-a-point}
we see $\kappa(s) \subset \kappa(x)$ is algebraic and
there are no other points of $X_s$ specializing to $x$.
Hence $x$ is closed in its fibre by
Lemma \ref{lemma-algebraic-residue-field-extension-closed-point-fibre}
and by
Lemma \ref{lemma-quasi-finite-at-point-characterize} (3)
we conclude that $f$ is quasi-finite at $x$.

\medskip\noindent
Second proof. The fibre $X_s$ is a scheme locally of finite type over a field,
hence locally Noetherian (Lemma \ref{lemma-finite-type-noetherian}).
The result now follows from
Lemma \ref{lemma-quasi-finite-at-point-characterize}
and Properties, Lemma \ref{properties-lemma-isolated-dim-0-locally-noetherian}.
\end{proof}

\begin{lemma}
\label{lemma-rel-dimension-dimension}
Let $f : X \to Y$ be a morphism of locally Noetherian schemes
which is flat, locally of finite type and of relative dimension $d$.
For every point $x$ in $X$ with image
$y$ in $Y$ we have $\dim_x(X) = \dim_y(Y) + d$.
\end{lemma}

\begin{proof}
After shrinking $X$ and $Y$ to open neighborhoods of $x$ and $y$,
we can assume that $\dim(X) = \dim_x(X)$ and $\dim(Y) = \dim_y(Y)$,
by definition of the dimension of a scheme at a point
(Properties, Definition \ref{properties-definition-dimension}).
The morphism $f$ is open by Lemmas
\ref{lemma-noetherian-finite-type-finite-presentation} and
\ref{lemma-fppf-open}.
Hence we can shrink $Y$ to arrange that $f$ is surjective.
It remains to show that $\dim(X) = \dim(Y) + d$.

\medskip\noindent
Let $a$ be a point in $X$ with image $b$ in $Y$. By
Algebra, Lemma \ref{algebra-lemma-dimension-base-fibre-equals-total},
$$
\dim(\mathcal{O}_{X,a}) = \dim(\mathcal{O}_{Y,b}) + \dim(\mathcal{O}_{X_b, a}).
$$
Taking the supremum over all points $a$ in $X$, it follows
that $\dim(X) = \dim(Y) + d$, as we want, see
Properties, Lemma \ref{properties-lemma-dimension}.
\end{proof}











\section{Syntomic morphisms}
\label{section-syntomic}

\noindent
An algebra $A$ over a field $k$ is called a
{\it global complete intersection over $k$}
if $A \cong k[x_1, \ldots, x_n]/(f_1, \ldots, f_c)$ and
$\dim(A) = n - c$. An algebra $A$ over a field $k$ is called a
{\it local complete intersection} if $\Spec(A)$
can be covered by standard opens each of which are global
complete intersections over $k$. See Algebra, Section
\ref{algebra-section-lci}. Recall that a ring map $R \to A$
is {\it syntomic} if it is of finite presentation,
flat with local complete intersection rings as fibres,
see Algebra, Definition \ref{algebra-definition-lci}.

\begin{definition}
\label{definition-syntomic}
Let $f : X \to S$ be a morphism of schemes.
\begin{enumerate}
\item We say that $f$ is {\it syntomic at $x \in X$} if
there exists an affine open neighbourhood $\Spec(A) = U \subset X$
of $x$ and affine open $\Spec(R) = V \subset S$
with $f(U) \subset V$ such that the induced ring map
$R \to A$ is syntomic.
\item We say that $f$ is {\it syntomic} if it is syntomic
at every point of $X$.
\item If $S = \Spec(k)$ and $f$ is syntomic, then we say that
$X$ is a {\it local complete intersection over $k$}.
\item A morphism of affine schemes $f : X \to S$
is called {\it standard syntomic} if there exists a
global relative complete intersection
$R \to R[x_1, \ldots, x_n]/(f_1, \ldots, f_c)$ (see
Algebra,
Definition \ref{algebra-definition-relative-global-complete-intersection})
such that $X \to S$ is isomorphic to
$$
\Spec(R[x_1, \ldots, x_n]/(f_1, \ldots, f_c)) \to \Spec(R).
$$
\end{enumerate}
\end{definition}

\noindent
In the literature a syntomic morphism is sometimes referred to as a
{\it flat local complete intersection morphism}.
It turns out this is a convenient class of morphisms. For example one
can define a syntomic topology using these, which is finer than the
smooth and \'etale topologies, but has many of the same formal properties.

\medskip\noindent
A global relative complete intersection (which we used to define standard
syntomic ring maps) is in particular flat. In
More on Morphisms, Section \ref{more-morphisms-section-lci}
we will consider morphisms $X \to S$ which locally are of the form
$$
\Spec(R[x_1, \ldots, x_n]/(f_1, \ldots, f_c)) \to \Spec(R).
$$
for some Koszul-regular sequence $f_1, \ldots, f_r$ in $R[x_1, \ldots, x_n]$.
Such a morphism will be called a {\it local complete intersection morphism}.
Once we have this definition in place it will be the case that a morphism
is syntomic if and only if it is a flat, local complete intersection morphism.

\medskip\noindent
Note that there is no separation or quasi-compactness hypotheses in the
definition of a syntomic morphism. Hence the question of being syntomic
is local in nature on the source. Here is the precise result.

\begin{lemma}
\label{lemma-syntomic-characterize}
Let $f : X \to S$ be a morphism of schemes.
The following are equivalent
\begin{enumerate}
\item The morphism $f$ is syntomic.
\item For every affine opens $U \subset X$, $V \subset S$
with $f(U) \subset V$ the ring map
$\mathcal{O}_S(V) \to \mathcal{O}_X(U)$ is syntomic.
\item There exists an open covering $S = \bigcup_{j \in J} V_j$
and open coverings $f^{-1}(V_j) = \bigcup_{i \in I_j} U_i$ such
that each of the morphisms $U_i \to V_j$, $j\in J, i\in I_j$
is syntomic.
\item There exists an affine open covering $S = \bigcup_{j \in J} V_j$
and affine open coverings $f^{-1}(V_j) = \bigcup_{i \in I_j} U_i$ such
that the ring map $\mathcal{O}_S(V_j) \to \mathcal{O}_X(U_i)$ is
syntomic, for all $j\in J, i\in I_j$.
\end{enumerate}
Moreover, if $f$ is syntomic then for
any open subschemes $U \subset X$, $V \subset S$ with $f(U) \subset V$
the restriction $f|_U : U \to V$ is syntomic.
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-locally-P} if we show that
the property ``$R \to A$ is syntomic'' is local.
We check conditions (a), (b) and (c) of Definition
\ref{definition-property-local}.
By Algebra, Lemma \ref{algebra-lemma-base-change-syntomic}
being syntomic is stable under base change and hence
we conclude (a) holds. By
Algebra, Lemma \ref{algebra-lemma-composition-syntomic}
being syntomic is stable under composition and trivially for any ring
$R$ the ring map $R \to R_f$ is syntomic.
We conclude (b) holds. Finally, property (c) is true
according to Algebra, Lemma \ref{algebra-lemma-local-syntomic}.
\end{proof}

\begin{lemma}
\label{lemma-composition-syntomic}
The composition of two morphisms which are syntomic is syntomic.
\end{lemma}

\begin{proof}
In the proof of Lemma \ref{lemma-syntomic-characterize}
we saw that being syntomic is a local property of ring maps.
Hence the first statement of the lemma follows from
Lemma \ref{lemma-composition-type-P} combined
with the fact that being syntomic is a property of ring maps that is
stable under composition, see
Algebra, Lemma \ref{algebra-lemma-composition-syntomic}.
\end{proof}

\begin{lemma}
\label{lemma-base-change-syntomic}
The base change of a morphism which is syntomic is syntomic.
\end{lemma}

\begin{proof}
In the proof of Lemma \ref{lemma-syntomic-characterize}
we saw that being syntomic is a local property of ring maps.
Hence the lemma follows from
Lemma \ref{lemma-composition-type-P} combined
with the fact that being syntomic is a property of ring maps that is
stable under base change, see
Algebra, Lemma \ref{algebra-lemma-base-change-syntomic}.
\end{proof}

\begin{lemma}
\label{lemma-open-immersion-syntomic}
Any open immersion is syntomic.
\end{lemma}

\begin{proof}
This is true because an open immersion is a local isomorphism.
\end{proof}

\begin{lemma}
\label{lemma-syntomic-locally-finite-presentation}
A syntomic morphism is locally of finite presentation.
\end{lemma}

\begin{proof}
True because a syntomic ring map is of finite presentation by
definition.
\end{proof}

\begin{lemma}
\label{lemma-syntomic-flat}
A syntomic morphism is flat.
\end{lemma}

\begin{proof}
True because a syntomic ring map is flat by definition.
\end{proof}

\begin{lemma}
\label{lemma-syntomic-open}
A syntomic morphism is universally open.
\end{lemma}

\begin{proof}
Combine
Lemmas \ref{lemma-syntomic-locally-finite-presentation},
\ref{lemma-syntomic-flat}, and
\ref{lemma-fppf-open}.
\end{proof}

\noindent
Let $k$ be a field. Let $A$ be a local $k$-algebra essentially
of finite type over $k$. Recall that $A$ is called a
{\it complete intersection over $k$} if we can write
$A \cong R/(f_1, \ldots, f_c)$ where $R$ is a regular local ring
essentially of finite type over $k$, and $f_1, \ldots, f_c$ is
a regular sequence in $R$, see
Algebra, Definition \ref{algebra-definition-lci-local-ring}.

\begin{lemma}
\label{lemma-local-complete-intersection}
Let $k$ be a field.
Let $X$ be a scheme locally of finite type over $k$.
The following are equivalent:
\begin{enumerate}
\item $X$ is a local complete intersection over $k$,
\item for every $x \in X$ there exists an affine open
$U = \Spec(R) \subset X$ neighbourhood of $x$
such that $R \cong k[x_1, \ldots, x_n]/(f_1, \ldots, f_c)$
is a global complete intersection over $k$, and
\item for every $x \in X$ the local ring $\mathcal{O}_{X, x}$
is a complete intersection over $k$.
\end{enumerate}
\end{lemma}

\begin{proof}
The corresponding algebra results can be found in
Algebra, Lemmas \ref{algebra-lemma-lci-at-prime} and
\ref{algebra-lemma-lci-global}.
\end{proof}

\noindent
The following lemma says locally any syntomic morphism is standard syntomic.
Hence we can use standard syntomic morphisms as a {\it local model}
for a syntomic morphism. Moreover, it says that a flat morphism of finite
presentation is syntomic if and only if the fibres are local complete
intersection schemes.

\begin{lemma}
\label{lemma-syntomic-locally-standard-syntomic}
Let $f : X  \to S$ be a morphism of schemes. Let $x \in X$ be a point
with image $s = f(x)$. Let $V \subset S$ be an affine open neighbourhood
of $s$. The following are equivalent
\begin{enumerate}
\item The morphism $f$ is syntomic at $x$.
\item There exist an affine open $U \subset X$ with $x \in U$ and
$f(U) \subset V$ such that $f|_U : U \to V$ is standard syntomic.
\item The morphism $f$ is of finite presentation at $x$, the local ring map
$\mathcal{O}_{S, s} \to \mathcal{O}_{X, x}$
is flat and $\mathcal{O}_{X, x}/\mathfrak m_s \mathcal{O}_{X, x}$
is a complete intersection over $\kappa(s)$ (see
Algebra, Definition \ref{algebra-definition-lci-local-ring}).
\end{enumerate}
\end{lemma}

\begin{proof}
Follows from the definitions and
Algebra, Lemma \ref{algebra-lemma-syntomic}.
\end{proof}

\begin{lemma}
\label{lemma-syntomic-flat-fibres}
Let $f : X \to S$ be a morphism of schemes.
If $f$ is flat, locally of finite presentation, and all
fibres $X_s$ are local complete intersections, then $f$
is syntomic.
\end{lemma}

\begin{proof}
Clear from Lemmas
\ref{lemma-local-complete-intersection} and
\ref{lemma-syntomic-locally-standard-syntomic}
and the isomorphisms of local rings
$
\mathcal{O}_{X, x}/\mathfrak m_s \mathcal{O}_{X, x}
\cong
\mathcal{O}_{X_s, x}
$.
\end{proof}

\begin{lemma}
\label{lemma-set-points-where-fibres-lci}
Let $f : X \to S$ be a morphism of schemes.
Assume $f$ locally of finite type. Formation of the set
$$
T = \{x \in X \mid \mathcal{O}_{X_{f(x)}, x}
\text{ is a complete intersection over }\kappa(f(x))\}
$$
commutes with arbitrary base change:
For any morphism $g : S' \to S$, consider
the base change $f' : X' \to S'$ of $f$ and the
projection $g' : X' \to X$. Then the corresponding
set $T'$ for the morphism $f'$ is equal to $T' = (g')^{-1}(T)$.
In particular, if $f$ is assumed flat, and locally of finite
presentation then the same holds for the open set of points
where $f$ is syntomic.
\end{lemma}

\begin{proof}
Let $s' \in S'$ be a point, and let $s = g(s')$. Then we have
$$
X'_{s'} =
\Spec(\kappa(s')) \times_{\Spec(\kappa(s))} X_s
$$
In other words the fibres of the base change are the base changes
of the fibres. Hence the first part is equivalent to
Algebra, Lemma \ref{algebra-lemma-lci-field-change-local}.
The second part follows from the first because in that case
$T$ is the set of points where $f$ is syntomic according to
Lemma \ref{lemma-syntomic-locally-standard-syntomic}.
\end{proof}

\begin{lemma}
\label{lemma-standard-syntomic-relative-dimension}
Let $R$ be a ring.
Let $R \to A = R[x_1, \ldots, x_n]/(f_1, \ldots, f_c)$ be a relative
global complete intersection. Set $S = \Spec(R)$ and
$X = \Spec(A)$. Consider the morphism
$f : X \to S$ associated to the ring map $R \to A$.
The function $x \mapsto \dim_x(X_{f(x)})$ is constant with value $n - c$.
\end{lemma}

\begin{proof}
By Algebra,
Definition \ref{algebra-definition-relative-global-complete-intersection}
$R \to A$ being a relative global complete intersection means
all nonzero fibre rings have dimension $n - c$.
Thus for a prime $\mathfrak p$ of $R$ the fibre ring
$\kappa(\mathfrak p)[x_1, \ldots, x_n]/(\overline{f}_1, \ldots, \overline{f}_c)$
is either zero or a global complete intersection ring of dimension $n - c$.
By the discussion following
Algebra, Definition \ref{algebra-definition-lci-field}
this implies it is equidimensional of dimension $n - c$.
Whence the lemma.
\end{proof}

\begin{lemma}
\label{lemma-syntomic-relative-dimension}
Let $f : X \to S$ be a syntomic morphism. The function
$x \mapsto \dim_x(X_{f(x)})$ is locally constant on $X$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-syntomic-locally-standard-syntomic}
the morphism $f$ locally looks like a standard
syntomic morphism of affines. Hence the result follows
from Lemma \ref{lemma-standard-syntomic-relative-dimension}.
\end{proof}

\noindent
Lemma \ref{lemma-syntomic-relative-dimension}
says that the following definition makes sense.

\begin{definition}
\label{definition-syntomic-relative-dimension}
Let $d \geq 0$ be an integer. We say a morphism of schemes $f : X \to S$
is {\it syntomic of relative dimension $d$} if $f$ is syntomic and
the function $\dim_x(X_{f(x)}) = d$ for all $x \in X$.
\end{definition}

\noindent
In other words, $f$ is syntomic and the nonempty fibres are equidimensional
of dimension $d$.

\begin{lemma}
\label{lemma-syntomic-permanence}
Let
$$
\xymatrix{
X \ar[rr]_f \ar[rd]_p & &
Y \ar[dl]^q \\
& S
}
$$
be a commutative diagram of morphisms of schemes. Assume that
\begin{enumerate}
\item $f$ is surjective and syntomic,
\item $p$ is syntomic, and
\item $q$ is locally of finite presentation\footnote{In fact, if $f$ is
surjective, flat, and locally of finite presentation and $p$ is syntomic,
then both $q$ and $f$ are syntomic, see
Descent, Lemma \ref{descent-lemma-syntomic-permanence}.}.
\end{enumerate}
Then $q$ is syntomic.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-flat-permanence} we see that $q$ is flat.
Hence it suffices to show that the fibres of $Y \to S$ are
local complete intersections, see Lemma \ref{lemma-syntomic-flat-fibres}.
Let $s \in S$. Consider the morphism $X_s \to Y_s$.
This is a base change of the morphism $X \to Y$ and hence
surjective, and syntomic (Lemma \ref{lemma-base-change-syntomic}).
For the same reason $X_s$ is syntomic over $\kappa(s)$.
Moreover, $Y_s$ is locally of finite type over $\kappa(s)$
(Lemma \ref{lemma-base-change-finite-type}). In this way
we reduce to the case where $S$ is the spectrum of a field.

\medskip\noindent
Assume $S = \Spec(k)$. Let $y \in Y$. Choose an affine
open $\Spec(A) \subset Y$ neighbourhood of $y$. Let
$\Spec(B) \subset X$ be an affine open such that
$f(\Spec(B)) \subset \Spec(A)$, containing
a point $x \in X$ such that $f(x) = y$. Choose a surjection
$k[x_1, \ldots, x_n] \to A$ with kernel $I$.
Choose a surjection $A[y_1, \ldots, y_m] \to B$, which gives
rise in turn to a surjection $k[x_i, y_j] \to B$ with kernel $J$.
Let $\mathfrak q \subset k[x_i, y_j]$ be the prime corresponding
to $y \in \Spec(B)$ and let $\mathfrak p \subset k[x_i]$ the prime
corresponding to $x \in \Spec(A)$.
Since $x$ maps to $y$ we have $\mathfrak p = \mathfrak q \cap k[x_i]$.
Consider the following commutative diagram of local rings:
$$
\xymatrix{
\mathcal{O}_{X, x} \ar@{=}[r] &
B_{\mathfrak q} &
k[x_1, \ldots, x_n, y_1, \ldots, y_m]_{\mathfrak q} \ar[l] \\
\mathcal{O}_{Y, y} \ar@{=}[r] \ar[u] & A_{\mathfrak p} \ar[u] &
k[x_1, \ldots, x_n]_{\mathfrak p} \ar[l] \ar[u]
}
$$
We claim that the hypotheses of
Algebra, Lemma \ref{algebra-lemma-lci-permanence-initial} are satisfied.
Conditions (1) and (2) are trivial. Condition (4) follows as
$X \to Y$ is flat. Condition (3) follows as the rings
$\mathcal{O}_{Y, y}$ and
$\mathcal{O}_{X_y, x} = \mathcal{O}_{X, x}/\mathfrak m_y\mathcal{O}_{X, x}$
are complete intersection rings by our assumptions that
$f$ and $p$ are syntomic, see
Lemma \ref{lemma-syntomic-locally-standard-syntomic}.
The output of Algebra, Lemma \ref{algebra-lemma-lci-permanence-initial}
is exactly that $\mathcal{O}_{Y, y}$ is a complete intersection
ring! Hence by Lemma \ref{lemma-syntomic-locally-standard-syntomic}
again we see that $Y$ is syntomic over $k$ at $y$ as desired.
\end{proof}









\section{Conormal sheaf of an immersion}
\label{section-conormal-sheaf}

\noindent
Let $i : Z \to X$ be a closed immersion. Let
$\mathcal{I} \subset \mathcal{O}_X$ be the corresponding quasi-coherent
sheaf of ideals. Consider the short exact sequence
$$
0 \to \mathcal{I}^2 \to \mathcal{I} \to \mathcal{I}/\mathcal{I}^2 \to 0
$$
of quasi-coherent sheaves on $X$. Since the sheaf $\mathcal{I}/\mathcal{I}^2$
is annihilated by $\mathcal{I}$ it corresponds to a sheaf on $Z$ by
Lemma \ref{lemma-i-star-equivalence}. This quasi-coherent
$\mathcal{O}_Z$-module is called the {\it conormal sheaf of $Z$ in $X$}
and is often simply denoted
$\mathcal{I}/\mathcal{I}^2$ by the abuse of notation mentioned in
Section \ref{section-closed-immersions-quasi-coherent}.

\medskip\noindent
In case $i : Z \to X$ is a (locally closed) immersion we define the
conormal sheaf of $i$ as the conormal sheaf of the closed
immersion $i : Z \to X \setminus \partial Z$, where
$\partial Z = \overline{Z} \setminus Z$. It is often denoted
$\mathcal{I}/\mathcal{I}^2$ where $\mathcal{I}$ is the ideal sheaf
of the closed immersion $i : Z \to X \setminus \partial Z$.

\begin{definition}
\label{definition-conormal-sheaf}
Let $i : Z \to X$ be an immersion. The {\it conormal sheaf
$\mathcal{C}_{Z/X}$ of $Z$ in $X$} or the {\it conormal sheaf of $i$}
is the quasi-coherent $\mathcal{O}_Z$-module $\mathcal{I}/\mathcal{I}^2$
described above.
\end{definition}

\noindent
In \cite[IV Definition 16.1.2]{EGA} this sheaf is denoted
$\mathcal{N}_{Z/X}$. We will not follow this convention since we would
like to reserve the notation $\mathcal{N}_{Z/X}$
for the {\it normal sheaf of the immersion}. It is defined as
$$
\mathcal{N}_{Z/X} =
\SheafHom_{\mathcal{O}_Z}(\mathcal{C}_{Z/X}, \mathcal{O}_Z) =
\SheafHom_{\mathcal{O}_Z}(\mathcal{I}/\mathcal{I}^2, \mathcal{O}_Z)
$$
provided the conormal sheaf is of finite presentation (otherwise the
normal sheaf may not even be quasi-coherent). We will come back to the
normal sheaf later (insert future reference here).

\begin{lemma}
\label{lemma-affine-conormal}
Let $i : Z \to X$ be an immersion. The conormal sheaf
of $i$ has the following properties:
\begin{enumerate}
\item Let $U \subset X$ be any open subscheme such that $i$
factors as $Z \xrightarrow{i'} U \to X$ where $i'$ is a closed
immersion. Let $\mathcal{I} = \Ker((i')^\sharp) \subset \mathcal{O}_U$.
Then
$$
\mathcal{C}_{Z/X} = (i')^*\mathcal{I}\quad\text{and}\quad
i'_*\mathcal{C}_{Z/X} = \mathcal{I}/\mathcal{I}^2
$$
\item
For any affine open $\Spec(R) = U \subset X$
such that $Z \cap U = \Spec(R/I)$ there is a
canonical isomorphism
$\Gamma(Z \cap U, \mathcal{C}_{Z/X}) = I/I^2$.
\end{enumerate}
\end{lemma}

\begin{proof}
Mostly clear from the definitions. Note that given a ring $R$ and
an ideal $I$ of $R$ we have $I/I^2 = I \otimes_R R/I$. Details omitted.
\end{proof}

\begin{lemma}
\label{lemma-conormal-functorial}
Let
$$
\xymatrix{
Z \ar[r]_i \ar[d]_f & X \ar[d]^g \\
Z' \ar[r]^{i'} & X'
}
$$
be a commutative diagram in the category of schemes.
Assume $i$, $i'$ immersions. There is a canonical map
of $\mathcal{O}_Z$-modules
$$
f^*\mathcal{C}_{Z'/X'}
\longrightarrow
\mathcal{C}_{Z/X}
$$
characterized by the following property: For every pair of affine opens
$(\Spec(R) = U \subset X, \Spec(R') = U' \subset X')$ with
$g(U) \subset U'$ such that
$Z \cap U = \Spec(R/I)$ and $Z' \cap U' = \Spec(R'/I')$
the induced map
$$
\Gamma(Z' \cap U', \mathcal{C}_{Z'/X'}) = I'/I'^2
\longrightarrow
I/I^2 = \Gamma(Z \cap U, \mathcal{C}_{Z/X})
$$
is the one induced by the ring map $g^\sharp : R' \to R$ which
has the property $g^\sharp(I') \subset I$.
\end{lemma}

\begin{proof}
Let $\partial Z' = \overline{Z'} \setminus Z'$ and
$\partial Z = \overline{Z} \setminus Z$. These are closed subsets of $X'$ and
of $X$. Replacing $X'$ by $X' \setminus \partial Z'$ and $X$ by
$X \setminus \big(g^{-1}(\partial Z') \cup \partial Z\big)$ we
see that we may assume that $i$ and $i'$ are closed immersions.

\medskip\noindent
The fact that $g \circ i$ factors through $i'$ implies that
$g^*\mathcal{I}'$ maps into $\mathcal{I}$ under the canonical
map $g^*\mathcal{I}' \to \mathcal{O}_X$, see
Schemes, Lemmas
\ref{schemes-lemma-characterize-closed-subspace} and
\ref{schemes-lemma-restrict-map-to-closed}.
Hence we get an induced map of quasi-coherent sheaves
$g^*(\mathcal{I}'/(\mathcal{I}')^2) \to \mathcal{I}/\mathcal{I}^2$.
Pulling back by $i$ gives
$i^*g^*(\mathcal{I}'/(\mathcal{I}')^2) \to i^*(\mathcal{I}/\mathcal{I}^2)$.
Note that $i^*(\mathcal{I}/\mathcal{I}^2) = \mathcal{C}_{Z/X}$.
On the other hand,
$i^*g^*(\mathcal{I}'/(\mathcal{I}')^2) =
f^*(i')^*(\mathcal{I}'/(\mathcal{I}')^2) = f^*\mathcal{C}_{Z'/X'}$.
This gives the desired map.

\medskip\noindent
Checking that the map is locally described as the given map
$I'/(I')^2 \to I/I^2$ is a matter of unwinding the definitions
and is omitted. Another observation is that given any
$x \in i(Z)$ there do exist affine open neighbourhoods $U$, $U'$
with $f(U) \subset U'$ and $Z \cap U$ as well as $U' \cap Z'$
closed such that $x \in U$. Proof omitted. Hence the requirement
of the lemma indeed characterizes the map (and could have been used
to define it).
\end{proof}

\begin{lemma}
\label{lemma-conormal-functorial-flat}
Let
$$
\xymatrix{
Z \ar[r]_i \ar[d]_f & X \ar[d]^g \\
Z' \ar[r]^{i'} & X'
}
$$
be a fibre product diagram in the category of schemes with
$i$, $i'$ immersions. Then the canonical map
$f^*\mathcal{C}_{Z'/X'} \to \mathcal{C}_{Z/X}$ of
Lemma \ref{lemma-conormal-functorial}
is surjective. If $g$ is flat, then it is an isomorphism.
\end{lemma}

\begin{proof}
Let $R' \to R$ be a ring map, and $I' \subset R'$ an ideal.
Set $I = I'R$. Then $I'/(I')^2 \otimes_{R'} R \to I/I^2$ is
surjective. If $R' \to R$ is flat, then $I = I' \otimes_{R'} R$
and $I^2 = (I')^2 \otimes_{R'} R$ and we see the map is an
isomorphism.
\end{proof}

\begin{lemma}
\label{lemma-transitivity-conormal}
Let $Z \to Y \to X$ be immersions of schemes. Then there is a canonical
exact sequence
$$
i^*\mathcal{C}_{Y/X} \to
\mathcal{C}_{Z/X} \to
\mathcal{C}_{Z/Y} \to 0
$$
where the maps come from
Lemma \ref{lemma-conormal-functorial}
and $i : Z \to Y$ is the first morphism.
\end{lemma}

\begin{proof}
Via
Lemma \ref{lemma-conormal-functorial}
this translates into the following algebra fact. Suppose that
$C \to B \to A$ are surjective ring maps. Let $I = \Ker(B \to A)$,
$J = \Ker(C \to A)$ and $K = \Ker(C \to B)$. Then
there is an exact sequence
$$
K/K^2 \otimes_B A \to J/J^2 \to I/I^2 \to 0.
$$
This follows immediately from the observation that $I = J/K$.
\end{proof}










\section{Sheaf of differentials of a morphism}
\label{section-sheaf-differentials}

\noindent
We suggest the reader take a look at the corresponding section
in the chapter on commutative algebra
(Algebra, Section \ref{algebra-section-differentials})
and the corresponding section in the chapter on sheaves of modules
(Modules, Section \ref{modules-section-differentials}).

\begin{definition}
\label{definition-sheaf-differentials}
Let $f : X \to S$ be a morphism of schemes.
The {\it sheaf of differentials $\Omega_{X/S}$ of $X$ over $S$} is
the sheaf of differentials of $f$ viewed as a morphism of ringed spaces
(Modules, Definition \ref{modules-definition-differentials})
equipped with its {\it universal $S$-derivation}
$$
\text{d}_{X/S} : \mathcal{O}_X \longrightarrow \Omega_{X/S}.
$$
\end{definition}

\noindent
It turns out that $\Omega_{X/S}$ is a quasi-coherent $\mathcal{O}_X$-module
for example as it is isomorphic to the conormal sheaf
of the diagonal morphism $\Delta : X \to X \times_S X$
(Lemma \ref{lemma-differentials-diagonal}).
We have defined the module of differentials of $X$ over $S$ using a
universal property, namely as the receptacle of the universal derivation.
If you have any other construction of the sheaf of relative differentials
which satisfies this universal property then, by the Yoneda lemma,
it will be canonically isomorphic to the one defined above. For convenience
we restate the universal property here.

\begin{lemma}
\label{lemma-universal-derivation-universal}
Let $f : X \to S$ be a morphism of schemes. The map
$$
\Hom_{\mathcal{O}_X}(\Omega_{X/S}, \mathcal{F})
\longrightarrow
\text{Der}_S(\mathcal{O}_X, \mathcal{F}),\quad
\alpha \longmapsto \alpha \circ \text{d}_{X/S}
$$
is an isomorphism of functors $\textit{Mod}(\mathcal{O}_X) \to \textit{Sets}$.
\end{lemma}

\begin{proof}
This is just a restatement of the definition.
\end{proof}

\begin{lemma}
\label{lemma-differentials-restrict-open}
Let $f : X \to S$ be a morphism of schemes.
Let $U \subset X$, $V \subset S$ be open subschemes such
that $f(U) \subset V$. Then there is a unique isomorphism
$\Omega_{X/S}|_U = \Omega_{U/V}$ of $\mathcal{O}_U$-modules such that
$\text{d}_{X/S}|_U = \text{d}_{U/V}$.
\end{lemma}

\begin{proof}
This is a special case of
Modules, Lemma \ref{modules-lemma-localize-differentials}
if we use the canonical identification
$f^{-1}\mathcal{O}_S|_U = (f|_U)^{-1}\mathcal{O}_V$.
\end{proof}

\noindent
From now on we will use these canonical identifications and simply
write $\Omega_{U/S}$ or $\Omega_{U/V}$ for the restriction of
$\Omega_{X/S}$ to $U$.

\begin{lemma}
\label{lemma-affine-case-derivation}
Let $R \to A$ be a ring map. Let $\mathcal{F}$
be a sheaf of $\mathcal{O}_X$-modules
on $X = \Spec(A)$. Set $S = \Spec(R)$.
The rule which associates to an $S$-derivation on $\mathcal{F}$
its action on global sections defines a bijection between
the set of $S$-derivations of $\mathcal{F}$ and the set of
$R$-derivations on $M = \Gamma(X, \mathcal{F})$.
\end{lemma}

\begin{proof}
Let $D : A \to M$ be an $R$-derivation. We have to show there exists
a unique $S$-derivation on $\mathcal{F}$ which gives rise to
$D$ on global sections. Let $U = D(f) \subset X$ be a standard affine open.
Any element of $\Gamma(U, \mathcal{O}_X)$ is of the form
$a/f^n$ for some $a \in A$ and $n \geq 0$. By the Leibniz rule
we have
$$
D(a)|_U = a/f^n D(f^n)|_U + f^n D(a/f^n)
$$
in $\Gamma(U, \mathcal{F})$. Since $f$ acts invertibly
on $\Gamma(U, \mathcal{F})$ this completely determines
the value of $D(a/f^n) \in \Gamma(U, \mathcal{F})$.
This proves uniqueness. Existence follows by simply defining
$$
D(a/f^n) := (1/f^n) D(a)|_U - a/f^{2n} D(f^n)|_U
$$
and proving this has all the desired properties (on the basis
of standard opens of $X$). Details omitted.
\end{proof}

\begin{lemma}
\label{lemma-differentials-affine}
Let $f : X \to S$ be a morphism of schemes. For any pair of affine opens
$\Spec(A) = U \subset X$, $\Spec(R) = V \subset S$ with $f(U) \subset V$
there is a unique isomorphism
$$
\Gamma(U, \Omega_{X/S}) = \Omega_{A/R}.
$$
compatible with $\text{d}_{X/S}$ and $\text{d} : A \to \Omega_{A/R}$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-differentials-restrict-open} we may replace
$X$ and $S$ by $U$ and $V$. Thus we may assume $X = \Spec(A)$
and $S = \Spec(R)$ and we have to show the lemma with $U = X$
and $V = S$. Consider the $A$-module $M = \Gamma(X, \Omega_{X/S})$
together with the $R$-derivation $\text{d}_{X/S} : A \to M$.
Let $N$ be another $A$-module and denote $\widetilde{N}$ the quasi-coherent
$\mathcal{O}_X$-module associated to $N$, see
Schemes, Section \ref{schemes-section-quasi-coherent-affine}.
Precomposing by $\text{d}_{X/S} : A \to M$ we get an arrow
$$
\alpha : \Hom_A(M, N) \longrightarrow \text{Der}_R(A, N)
$$
Using Lemmas \ref{lemma-universal-derivation-universal} and
\ref{lemma-affine-case-derivation} we get identifications
$$
\Hom_{\mathcal{O}_X}(\Omega_{X/S}, \widetilde{N}) =
\text{Der}_S(\mathcal{O}_X, \widetilde{N}) =
\text{Der}_R(A, N)
$$
Taking global sections determines an arrow
$\Hom_{\mathcal{O}_X}(\Omega_{X/S}, \widetilde{N}) \to \Hom_R(M, N)$.
Combining this arrow and the identifications above we get an arrow
$$
\beta : \text{Der}_R(A, N) \longrightarrow \Hom_R(M, N)
$$
Checking what happens on global sections, we find that $\alpha$
and $\beta$ are each others inverse. Hence we see that
$\text{d}_{X/S} : A \to M$ satisfies
the same universal property as $\text{d} : A \to \Omega_{A/R}$,
see Algebra, Lemma \ref{algebra-lemma-universal-omega}. Thus the Yoneda lemma
(Categories, Lemma \ref{categories-lemma-yoneda})
implies there is a unique isomorphism of $A$-modules
$M \cong \Omega_{A/R}$ compatible with derivations.
\end{proof}

\begin{remark}
\label{remark-differentials-glue}
The lemma above gives a second way of constructing the module of
differentials. Namely, let $f : X \to S$ be a morphism of schemes.
Consider the collection of all affine opens $U \subset X$ which
map into an affine open of $S$. These form a basis for the topology
on $X$. Thus it suffices to define $\Gamma(U, \Omega_{X/S})$
for such $U$. We simply set $\Gamma(U, \Omega_{X/S}) = \Omega_{A/R}$ if
$A$, $R$ are as in Lemma \ref{lemma-differentials-affine} above.
This works, but it takes somewhat more algebraic preliminaries
to construct the restriction mappings and to verify the sheaf
condition with this ansatz.
\end{remark}

\noindent
The following lemma gives yet another way to define the sheaf of
differentials and it in particular shows that $\Omega_{X/S}$
is quasi-coherent if $X$ and $S$ are schemes.

\begin{lemma}
\label{lemma-differentials-diagonal}
Let $f : X \to S$ be a morphism of schemes. There is a canonical
isomorphism between $\Omega_{X/S}$ and the conormal sheaf of
the diagonal morphism $\Delta_{X/S} : X \longrightarrow X \times_S X$.
\end{lemma}

\begin{proof}
We first establish the existence of a couple of ``global'' sheaves
and global maps of sheaves, and further down we describe
the constructions over some affine opens.

\medskip\noindent
Recall that $\Delta = \Delta_{X/S} : X \to X \times_S X$
is an immersion, see Schemes, Lemma \ref{schemes-lemma-diagonal-immersion}.
Let $\mathcal{J}$ be the ideal sheaf of the immersion
which lives over some open subscheme $W$ of $X \times_S X$
such that $\Delta(X) \subset W$ is closed. Let us take the one that
was found in the proof of
Schemes, Lemma \ref{schemes-lemma-diagonal-immersion}.
Note that the sheaf of rings $\mathcal{O}_W/\mathcal{J}^2$
is supported on $\Delta(X)$. Moreover it sits in a
short exact sequence of sheaves
$$
0 \to \mathcal{J}/\mathcal{J}^2
\to \mathcal{O}_W/\mathcal{J}^2
\to \Delta_*\mathcal{O}_X
\to 0.
$$
Using $\Delta^{-1}$ we can think of this as a surjection of
sheaves of $f^{-1}\mathcal{O}_S$-algebras with kernel the
conormal sheaf of $\Delta$ (see Definition \ref{definition-conormal-sheaf}
and Lemma \ref{lemma-affine-conormal}).
$$
0 \to \mathcal{C}_{X/X \times_S X}
\to \Delta^{-1}(\mathcal{O}_W/\mathcal{J}^2)
\to \mathcal{O}_X
\to 0
$$
This places us in the situation of
Modules, Lemma \ref{modules-lemma-double-structure-gives-derivation}.
The projection morphisms $p_i : X \times_S X \to X$, $i = 1, 2$ induce
maps of sheaves of rings
$(p_i)^\sharp : (p_i)^{-1}\mathcal{O}_X \to \mathcal{O}_{X \times_S X}$.
We may restrict to $W$ and quotient by $\mathcal{J}^2$ to get
$(p_i)^{-1}\mathcal{O}_X \to \mathcal{O}_W/\mathcal{J}^2$.
Since $\Delta^{-1}p_i^{-1}\mathcal{O}_X = \mathcal{O}_X$
we get maps
$$
s_i : \mathcal{O}_X \to \Delta^{-1}(\mathcal{O}_W/\mathcal{J}^2).
$$
Both $s_1$ and $s_2$ are sections to the map
$\Delta^{-1}(\mathcal{O}_W/\mathcal{J}^2) \to \mathcal{O}_X$,
as in Modules, Lemma \ref{modules-lemma-double-structure-gives-derivation}.
Thus we get an $S$-derivation
$\text{d} = s_2 - s_1 : \mathcal{O}_X \to \mathcal{C}_{X/X \times_S X}$.
By the universal property of the module of differentials we find a
unique $\mathcal{O}_X$-linear map
$$
\Omega_{X/S} \longrightarrow \mathcal{C}_{X/X \times_S X},\quad
f\text{d}g \longmapsto fs_2(g) - fs_1(g)
$$
To see the map is an isomorphism, let us work this out over suitable affine
opens. We can cover $X$ by affine opens $\Spec(A) = U \subset X$
whose image is contained in an affine open $\Spec(R) = V \subset S$.
According to the proof of Schemes, Lemma \ref{schemes-lemma-diagonal-immersion}
$U \times_V U \subset X \times_S X$ is an affine open
contained in the open $W$ mentioned above. Also
$U \times_V U = \Spec(A \otimes_R A)$.
The sheaf $\mathcal{J}$ corresponds to the ideal
$J = \Ker(A \otimes_R A \to A)$.
The short exact sequence to the short exact sequence
of $A \otimes_R A$-modules
$$
0 \to J/J^2 \to (A \otimes_R A)/J^2 \to A \to 0
$$
The sections $s_i$ correspond to the ring maps
$$
A \longrightarrow (A \otimes_R A)/J^2,\quad
s_1 : a \mapsto a \otimes 1,\quad
s_2 : a \mapsto 1 \otimes a.
$$
By Lemma \ref{lemma-affine-conormal} we have
$\Gamma(U, \mathcal{C}_{X/X \times_S X}) = J/J^2$ and
by Lemma \ref{lemma-differentials-affine}
we have $\Gamma(U, \Omega_{X/S}) = \Omega_{A/R}$.
The map above is the map $a \text{d}b \mapsto a \otimes b - ab \otimes 1$
which is shown to be an isomorphism in
Algebra, Lemma \ref{algebra-lemma-differentials-diagonal}.
\end{proof}

\begin{lemma}
\label{lemma-functoriality-differentials}
Let
$$
\xymatrix{
X' \ar[d] \ar[r]_f & X \ar[d] \\
S' \ar[r] & S
}
$$
be a commutative diagram of schemes. The canonical map
$\mathcal{O}_X \to f_*\mathcal{O}_{X'}$ composed with the map
$f_*\text{d}_{X'/S'} : f_*\mathcal{O}_{X'} \to f_*\Omega_{X'/S'}$ is a
$S$-derivation. Hence we obtain a canonical map of $\mathcal{O}_X$-modules
$\Omega_{X/S} \to f_*\Omega_{X'/S'}$, and by
adjointness of $f_*$ and $f^*$ a
canonical $\mathcal{O}_{X'}$-module homomorphism
$$
c_f : f^*\Omega_{X/S} \longrightarrow \Omega_{X'/S'}.
$$
It is uniquely characterized by the property that
$f^*\text{d}_{X/S}(h)$ maps to $\text{d}_{X'/S'}(f^* h)$
for any local section $h$ of $\mathcal{O}_X$.
\end{lemma}

\begin{proof}
This is a special case of
Modules, Lemma \ref{modules-lemma-functoriality-differentials-ringed-spaces}.
In the case of schemes we can also use the functoriality of
the conormal sheaves (see Lemma \ref{lemma-conormal-functorial}) and
Lemma \ref{lemma-differentials-diagonal} to define $c_f$.
Or we can use the characterization in the last line of the lemma to
glue maps defined on affine patches
(see Algebra, Equation (\ref{algebra-equation-functorial-omega})).
\end{proof}

\begin{lemma}
\label{lemma-triangle-differentials}
Let $f : X \to Y$, $g : Y \to S$ be morphisms of schemes.
Then there is a canonical exact sequence
$$
f^*\Omega_{Y/S} \to \Omega_{X/S} \to \Omega_{X/Y} \to 0
$$
where the maps come from applications of
Lemma \ref{lemma-functoriality-differentials}.
\end{lemma}

\begin{proof}
This is the sheafified version of
Algebra, Lemma \ref{algebra-lemma-exact-sequence-differentials}.
Alternatively, there is a general version for morphisms of ringed
spaces, see Modules, Lemma \ref{modules-lemma-triangle-differentials}.
\end{proof}

\begin{lemma}
\label{lemma-base-change-differentials}
Let $X \to S$ be a morphism of schemes.
Let $g : S' \to S$ be a morphism of schemes.
Let $X' = X_{S'}$ be the base change of $X$.
Denote $g' : X' \to X$ the projection.
Then the map
$$
(g')^*\Omega_{X/S} \to \Omega_{X'/S'}
$$
of Lemma \ref{lemma-functoriality-differentials} is an isomorphism.
\end{lemma}

\begin{proof}
This is the sheafified version of
Algebra, Lemma \ref{algebra-lemma-differentials-base-change}.
\end{proof}

\begin{lemma}
\label{lemma-differential-product}
Let $f : X \to S$ and $g : Y \to S$ be morphisms of schemes with the same
target. Let $p : X \times_S Y \to X$ and $q : X \times_S Y \to Y$ be the
projection morphisms. The maps from
Lemma \ref{lemma-functoriality-differentials}
$$
p^*\Omega_{X/S} \oplus q^*\Omega_{Y/S}
\longrightarrow
\Omega_{X \times_S Y/S}
$$
give an isomorphism.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-base-change-differentials} the composition
$p^*\Omega_{X/S} \to \Omega_{X \times_S Y/S} \to \Omega_{X \times_S Y/Y}$
is an isomorphism, and similarly for $q$. Moreover, the cokernel
of $p^*\Omega_{X/S} \to \Omega_{X \times_S Y/S}$ is
$\Omega_{X \times_S Y/X}$ by
Lemma \ref{lemma-triangle-differentials}. The result follows.
\end{proof}

\begin{lemma}
\label{lemma-finite-type-differentials}
Let $f : X \to S$ be a morphism of schemes.
If $f$ is locally of finite type, then $\Omega_{X/S}$ is
a finite type $\mathcal{O}_X$-module.
\end{lemma}

\begin{proof}
Immediate from
Algebra, Lemma \ref{algebra-lemma-differentials-finitely-generated},
Lemma \ref{lemma-differentials-affine},
Lemma \ref{lemma-locally-finite-type-characterize}, and
Properties, Lemma \ref{properties-lemma-finite-type-module}.
\end{proof}

\begin{lemma}
\label{lemma-finite-presentation-differentials}
Let $f : X \to S$ be a morphism of schemes.
If $f$ is locally of finite presentation, then $\Omega_{X/S}$ is
an $\mathcal{O}_X$-module of finite presentation.
\end{lemma}

\begin{proof}
Immediate from
Algebra, Lemma \ref{algebra-lemma-differentials-finitely-presented},
Lemma \ref{lemma-differentials-affine},
Lemma \ref{lemma-locally-finite-presentation-characterize}, and
Properties, Lemma \ref{properties-lemma-finite-presentation-module}.
\end{proof}

\begin{lemma}
\label{lemma-immersion-differentials}
If $X \to S$ is an immersion, or more generally a monomorphism, then
$\Omega_{X/S}$ is zero.
\end{lemma}

\begin{proof}
This is true because $\Delta_{X/S}$ is an isomorphism in this case
and hence has trivial conormal sheaf. Hence $\Omega_{X/S} = 0$
by Lemma \ref{lemma-differentials-diagonal}. The algebraic version is
Algebra, Lemma \ref{algebra-lemma-trivial-differential-surjective}.
\end{proof}

\begin{lemma}
\label{lemma-differentials-relative-immersion}
Let $i : Z \to X$ be an immersion of schemes over $S$.
There is a canonical exact sequence
$$
\mathcal{C}_{Z/X} \to i^*\Omega_{X/S} \to \Omega_{Z/S} \to 0
$$
where the first arrow is induced by $\text{d}_{X/S}$
and the second arrow comes from Lemma \ref{lemma-functoriality-differentials}.
\end{lemma}

\begin{proof}
This is the sheafified version of
Algebra, Lemma \ref{algebra-lemma-differential-seq}. However
we should make sure we can define the first arrow globally.
Hence we explain the meaning of ``induced by $\text{d}_{X/S}$'' here.
Namely, we may assume that $i$ is a closed immersion by
shrinking $X$. Let $\mathcal{I} \subset \mathcal{O}_X$
be the sheaf of ideals corresponding to $Z \subset X$.
Then $\text{d}_{X/S} : \mathcal{I} \to \Omega_{X/S}$
maps the subsheaf $\mathcal{I}^2 \subset \mathcal{I}$ to
$\mathcal{I}\Omega_{X/S}$. Hence it induces a map
$\mathcal{I}/\mathcal{I}^2 \to \Omega_{X/S}/\mathcal{I}\Omega_{X/S}$
which is $\mathcal{O}_X/\mathcal{I}$-linear.
By Lemma \ref{lemma-i-star-equivalence} this corresponds to a map
$\mathcal{C}_{Z/X} \to i^*\Omega_{X/S}$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-differentials-relative-immersion-section}
Let $i : Z \to X$ be an immersion of schemes over $S$, and
assume $i$ (locally) has a left inverse. Then the canonical
sequence
$$
0 \to \mathcal{C}_{Z/X} \to i^*\Omega_{X/S} \to \Omega_{Z/S} \to 0
$$
of
Lemma \ref{lemma-differentials-relative-immersion}
is (locally) split exact. In particular, if $s : S \to X$ is a section
of the structure morphism $X \to S$ then the map
$\mathcal{C}_{S/X} \to s^*\Omega_{X/S}$ induced by
$\text{d}_{X/S}$ is an isomorphism.
\end{lemma}

\begin{proof}
Follows from
Algebra, Lemma \ref{algebra-lemma-differential-seq-split}.
Clarification: if $g : X \to Z$ is a left inverse of $i$, then
$i^*c_g$ is a right inverse of the map $i^*\Omega_{X/S} \to \Omega_{Z/S}$.
Also, if $s$ is a section, then it is an immersion $s : Z = S \to X$
over $S$ (see
Schemes, Lemma \ref{schemes-lemma-section-immersion})
and in that case $\Omega_{Z/S} = 0$.
\end{proof}

\begin{remark}
\label{remark-differentials-diagonal}
Let $X \to S$ be a morphism of schemes. According to
Lemma \ref{lemma-differential-product}
we have
$$
\Omega_{X \times_S X/S} =
\text{pr}_1^*\Omega_{X/S} \oplus \text{pr}_2^*\Omega_{X/S}
$$
On the other hand, the diagonal morphism $\Delta : X \to X \times_S X$
is an immersion, which locally has a left inverse. Hence by
Lemma \ref{lemma-differentials-relative-immersion-section}
we obtain a canonical short exact sequence
$$
0 \to \mathcal{C}_{X/X \times_S X} \to \Omega_{X/S} \oplus \Omega_{X/S}
\to \Omega_{X/S} \to 0
$$
Note that the right arrow is $(1, 1)$ which is indeed a split surjection.
On the other hand, by Lemma \ref{lemma-differentials-diagonal}
we have an identification $\Omega_{X/S} = \mathcal{C}_{X/X \times_S X}$.
Because we chose $\text{d}_{X/S}(f) = s_2(f) - s_1(f)$ in this
identification it turns out that the left arrow is the map
$(-1, 1)$\footnote{Namely,
the local section $\text{d}_{X/S}(f) = 1 \otimes f - f \otimes 1$ of the
ideal sheaf of $\Delta$ maps via $\text{d}_{X \times_S X/X}$ to the
local section
$1 \otimes 1 \otimes 1 \otimes f - 1 \otimes f \otimes 1 \otimes 1
-1 \otimes 1 \otimes f \otimes 1 + f \otimes 1 \otimes 1 \otimes 1 =
\text{pr}_2^*\text{d}_{X/S}(f) - \text{pr}_1^*\text{d}_{X/S}(f)$.}.
\end{remark}

\begin{lemma}
\label{lemma-two-immersions}
Let
$$
\xymatrix{
Z \ar[r]_i \ar[rd]_j & X \ar[d] \\
& Y
}
$$
be a commutative diagram of schemes where $i$ and $j$ are immersions.
Then there is a canonical exact sequence
$$
\mathcal{C}_{Z/Y} \to
\mathcal{C}_{Z/X} \to
i^*\Omega_{X/Y} \to 0
$$
where the first arrow comes from
Lemma \ref{lemma-conormal-functorial}
and the second from
Lemma \ref{lemma-differentials-relative-immersion}.
\end{lemma}

\begin{proof}
The algebraic version of this is
Algebra, Lemma \ref{algebra-lemma-application-NL}.
\end{proof}










\section{Finite order differential operators}
\label{section-differential-operators}

\noindent
We suggest the reader take a look at the corresponding section
in the chapter on commutative algebra
(Algebra, Section \ref{algebra-section-differential-operators})
and the corresponding section in the chapter on sheaves of modules
(Modules, Section \ref{modules-section-differential-operators}).

\begin{lemma}
\label{lemma-affine-case-differential-operators}
Let $R \to A$ be a ring map. Denote $f : X \to S$ the corresponding
morphism of affine schemes. Let $\mathcal{F}$ and $\mathcal{G}$
be $\mathcal{O}_X$-modules. If $\mathcal{F}$ is quasi-coherent then
the map
$$
\text{Diff}^k_{X/S}(\mathcal{F}, \mathcal{G}) \to
\text{Diff}^k_{A/R}(\Gamma(X, \mathcal{F}), \Gamma(X, \mathcal{G}))
$$
sending a differential operator to its action on global sections
is bijective.
\end{lemma}

\begin{proof}
Write $\mathcal{F} = \widetilde{M}$ for some $A$-module $M$. Set
$N = \Gamma(X, \mathcal{G})$. Let $D : M \to N$ be a differential
operator of order $k$. We have to show there exists
a unique differential operator $\mathcal{F} \to \mathcal{G}$ of order $k$
which gives rise to $D$ on global sections. Let $U = D(f) \subset X$
be a standard affine open. Then $\mathcal{F}(U) = M_f$ is the localization.
By Algebra, Lemma \ref{algebra-lemma-invert-system-differential-operators}
the differential operator $D$ extends to a unique differential operator
$$
D_f : \mathcal{F}(U) = \widetilde{M}(U) = M_f \to N_f = \widetilde{N}(U)
$$
The uniqueness shows that these maps $D_f$ glue to give a map of sheaves
$\widetilde{M} \to \widetilde{N}$ on the basis of all standard opens
of $X$. Hence we get a unique map of sheaves
$\widetilde{D} : \widetilde{M} \to \widetilde{N}$ agreeing with these maps
by the material in Sheaves, Section \ref{sheaves-section-bases}.
Since $\widetilde{D}$ is given by differential operators of order $k$ on
the standard opens, we find that $\widetilde{D}$ is a differential operator
of order $k$ (small detail omitted).
Finally, we can post-compose with the canonical $\mathcal{O}_X$-module map
$c : \widetilde{N} \to \mathcal{G}$
(Schemes, Lemma \ref{schemes-lemma-compare-constructions})
to get $c \circ \widetilde{D} : \mathcal{F} \to \mathcal{G}$
which is a differential operator of order $k$ by
Modules, Lemma \ref{modules-lemma-composition-differential-operators}.
This proves existence. We omit the proof of uniqueness.
\end{proof}

\begin{lemma}
\label{lemma-base-change-differential-operators}
Let $a : X \to S$ and $b : Y \to S$ be morphisms of schemes.
Let $\mathcal{F}$ and $\mathcal{F}'$ be quasi-coherent $\mathcal{O}_X$-modules.
Let $D : \mathcal{F} \to \mathcal{F}'$ be a differential operator
of order $k$ on $X/S$. Let $\mathcal{G}$ be a quasi-coherent
$\mathcal{O}_Y$-module. Then there is a unique differential
operator
$$
D' :
\text{pr}_1^*\mathcal{F} \otimes_{\mathcal{O}_{X \times_S Y}}
\text{pr}_2^*\mathcal{G}
\longrightarrow
\text{pr}_1^*\mathcal{F}' \otimes_{\mathcal{O}_{X \times_S Y}}
\text{pr}_2^*\mathcal{G}
$$
of order $k$ on $X \times_S Y / Y$ such that
$
D'(s \otimes t) = D(s) \otimes t
$
for local sections $s$ of $\mathcal{F}$ and $t$ of $\mathcal{G}$.
\end{lemma}

\begin{proof}
In case $X$, $Y$, and $S$ are affine, this follows, via
Lemma \ref{lemma-affine-case-differential-operators},
from the corresponding algebra result, see
Algebra, Lemma \ref{algebra-lemma-base-change-differential-operators}.
In general, one uses coverings by affines
(for example as in Schemes, Lemma
\ref{schemes-lemma-affine-covering-fibre-product})
to construct $D'$ globally. Details omitted.
\end{proof}

\begin{remark}
\label{remark-base-change-differential-operators}
Let $a : X \to S$ and $b : Y \to S$ be morphisms of schemes.
Denote $p : X \times_S Y \to X$ and $q : X \times_S Y \to Y$ the
projections. In this remark, given an $\mathcal{O}_X$-module $\mathcal{F}$
and an $\mathcal{O}_Y$-module $\mathcal{G}$ let us set
$$
\mathcal{F} \boxtimes \mathcal{G} =
p^*\mathcal{F} \otimes_{\mathcal{O}_{X \times_S Y}} q^*\mathcal{G}
$$
Denote $\mathcal{A}_{X/S}$ the additive category
whose objects are quasi-coherent $\mathcal{O}_X$-modules and
whose morphisms are differential operators of finite order on $X/S$.
Similarly for $\mathcal{A}_{Y/S}$ and $\mathcal{A}_{X \times_S Y/S}$.
The construction of Lemma \ref{lemma-base-change-differential-operators}
determines a functor
$$
\boxtimes : 
\mathcal{A}_{X/S} \times \mathcal{A}_{Y/S} \longrightarrow
\mathcal{A}_{X \times_S Y/S},
\quad
(\mathcal{F}, \mathcal{G}) \longmapsto \mathcal{F} \boxtimes \mathcal{G}
$$
which is bilinear on morphisms. If $X = \Spec(A)$, $Y = \Spec(B)$, and
$S = \Spec(R)$, then via the identification of quasi-coherent sheaves
with modules this functor is given by $(M, N) \mapsto M \otimes_R N$
on objects and sends the morphism $(D, D') : (M, N) \to (M', N')$ to
$D \otimes D' : M \otimes_R N \to M' \otimes_R N'$.
\end{remark}








\section{Smooth morphisms}
\label{section-smooth}

\noindent
Let $f : X \to Y$ be a continuous map of topological spaces.
Consider the following condition:
For every $x \in X$ there exist open neighbourhoods
$x \in U \subset X$ and $f(x) \in V \subset Y$, and an integer $d$
such that $f(U) \subset V$ and such that we obtain
a commutative diagram
$$
\xymatrix{
X \ar[d] &
U \ar[l] \ar[d] \ar[r]_-\pi &
V \times \mathbf{R}^d \ar[ld] \\
Y & V \ar[l]
}
$$
where $\pi$ is a homeomorphism onto an open subset.
Smooth morphisms of schemes are the analogue of these maps
in the category of schemes. See
Lemma \ref{lemma-smooth-locally-standard-smooth}
and
Lemma \ref{lemma-smooth-etale-over-affine-space}.

\medskip\noindent
Contrary to expectations (perhaps) the notion
of a smooth ring map is not defined solely in terms
of the module of differentials. Namely, recall that
$R \to A$ is a {\it smooth ring map} if $A$ is of finite presentation over $R$
and if the naive cotangent complex of $A$ over $R$ is quasi-isomorphic
to a projective module placed in degree $0$, see
Algebra, Definition \ref{algebra-definition-smooth}.

\begin{definition}
\label{definition-smooth}
Let $f : X \to S$ be a morphism of schemes.
\begin{enumerate}
\item We say that $f$ is {\it smooth at $x \in X$} if
there exist an affine open neighbourhood $\Spec(A) = U \subset X$
of $x$ and affine open $\Spec(R) = V \subset S$
with $f(U) \subset V$ such that the induced ring map
$R \to A$ is smooth.
\item We say that $f$ is {\it smooth} if it is smooth at every point of $X$.
\item A morphism of affine schemes $f : X \to S$
is called {\it standard smooth} if there exists a standard smooth ring
map $R \to R[x_1, \ldots, x_n]/(f_1, \ldots, f_c)$ (see
Algebra, Definition \ref{algebra-definition-standard-smooth})
such that $X \to S$ is isomorphic to
$$
\Spec(R[x_1, \ldots, x_n]/(f_1, \ldots, f_c)) \to \Spec(R).
$$
\end{enumerate}
\end{definition}

\noindent
A pleasing feature of this definition is that the set of points
where a morphism is smooth is automatically open.

\medskip\noindent
Note that there is no separation or quasi-compactness hypotheses in the
definition. Hence the question of being smooth is local in nature on
the source. Here is the precise result.

\begin{lemma}
\label{lemma-smooth-characterize}
Let $f : X \to S$ be a morphism of schemes.
The following are equivalent
\begin{enumerate}
\item The morphism $f$ is smooth.
\item For every affine opens $U \subset X$, $V \subset S$
with $f(U) \subset V$ the ring map
$\mathcal{O}_S(V) \to \mathcal{O}_X(U)$ is smooth.
\item There exists an open covering $S = \bigcup_{j \in J} V_j$
and open coverings $f^{-1}(V_j) = \bigcup_{i \in I_j} U_i$ such
that each of the morphisms $U_i \to V_j$, $j\in J, i\in I_j$
is smooth.
\item There exists an affine open covering $S = \bigcup_{j \in J} V_j$
and affine open coverings $f^{-1}(V_j) = \bigcup_{i \in I_j} U_i$ such
that the ring map $\mathcal{O}_S(V_j) \to \mathcal{O}_X(U_i)$ is
smooth, for all $j\in J, i\in I_j$.
\end{enumerate}
Moreover, if $f$ is smooth then for
any open subschemes $U \subset X$, $V \subset S$ with $f(U) \subset V$
the restriction $f|_U : U \to V$ is smooth.
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-locally-P} if we show that
the property ``$R \to A$ is smooth'' is local.
We check conditions (a), (b) and (c) of Definition
\ref{definition-property-local}.
By Algebra, Lemma \ref{algebra-lemma-base-change-smooth}
being smooth is stable under base change and hence
we conclude (a) holds. By
Algebra, Lemma \ref{algebra-lemma-compose-smooth}
being smooth is stable under composition and for any ring
$R$ the ring map $R \to R_f$ is (standard) smooth.
We conclude (b) holds. Finally, property (c) is true
according to Algebra, Lemma \ref{algebra-lemma-locally-smooth}.
\end{proof}

\noindent
The following lemma characterizes a smooth morphism as a
flat, finitely presented morphism with smooth fibres.
Note that schemes smooth over a field are discussed in more detail in
Varieties, Section \ref{varieties-section-smooth}.

\begin{lemma}
\label{lemma-smooth-flat-smooth-fibres}
Let $f : X \to S$ be a morphism of schemes.
If $f$ is flat, locally of finite presentation, and all
fibres $X_s$ are smooth, then $f$
is smooth.
\end{lemma}

\begin{proof}
Follows from Algebra, Lemma \ref{algebra-lemma-flat-fibre-smooth}.
\end{proof}

\begin{lemma}
\label{lemma-composition-smooth}
The composition of two morphisms which are smooth is smooth.
\end{lemma}

\begin{proof}
In the proof of Lemma \ref{lemma-smooth-characterize}
we saw that being smooth is a local property of ring maps.
Hence the first statement of the lemma follows from
Lemma \ref{lemma-composition-type-P} combined
with the fact that being smooth is a property of ring maps that is
stable under composition, see
Algebra, Lemma \ref{algebra-lemma-compose-smooth}.
\end{proof}

\begin{lemma}
\label{lemma-base-change-smooth}
The base change of a morphism which is smooth is smooth.
\end{lemma}

\begin{proof}
In the proof of Lemma \ref{lemma-smooth-characterize}
we saw that being smooth is a local property of ring maps.
Hence the lemma follows from
Lemma \ref{lemma-composition-type-P} combined
with the fact that being smooth is a property of ring maps that is
stable under base change, see
Algebra, Lemma \ref{algebra-lemma-base-change-smooth}.
\end{proof}

\begin{lemma}
\label{lemma-open-immersion-smooth}
Any open immersion is smooth.
\end{lemma}

\begin{proof}
This is true because an open immersion is a local isomorphism.
\end{proof}

\begin{lemma}
\label{lemma-smooth-syntomic}
A smooth morphism is syntomic.
\end{lemma}

\begin{proof}
See Algebra, Lemma \ref{algebra-lemma-smooth-syntomic}.
\end{proof}

\begin{lemma}
\label{lemma-smooth-locally-finite-presentation}
A smooth morphism is locally of finite presentation.
\end{lemma}

\begin{proof}
True because a smooth ring map is of finite presentation by
definition.
\end{proof}

\begin{lemma}
\label{lemma-smooth-flat}
A smooth morphism is flat.
\end{lemma}

\begin{proof}
Combine Lemmas \ref{lemma-syntomic-flat} and \ref{lemma-smooth-syntomic}.
\end{proof}

\begin{lemma}
\label{lemma-smooth-open}
A smooth morphism is universally open.
\end{lemma}

\begin{proof}
Combine
Lemmas \ref{lemma-smooth-flat},
\ref{lemma-smooth-locally-finite-presentation}, and
\ref{lemma-fppf-open}.
Or alternatively, combine
Lemmas \ref{lemma-smooth-syntomic},
\ref{lemma-syntomic-open}.
\end{proof}

\noindent
The following lemma says locally any smooth morphism is standard smooth.
Hence we can use standard smooth morphisms as a {\it local model}
for a smooth morphism.

\begin{lemma}
\label{lemma-smooth-locally-standard-smooth}
\begin{slogan}
Smooth morphisms are locally standard smooth.
\end{slogan}
Let $f : X  \to S$ be a morphism of schemes.
Let $x \in X$ be a point.
Let $V \subset S$ be an affine open neighbourhood of $f(x)$.
The following are equivalent
\begin{enumerate}
\item The morphism $f$ is smooth at $x$.
\item There exists an affine open $U \subset X$,
with $x \in U$ and $f(U) \subset V$ such that the
induced morphism $f|_U : U \to V$ is standard smooth.
\end{enumerate}
\end{lemma}

\begin{proof}
Follows from the definitions and
Algebra, Lemmas \ref{algebra-lemma-standard-smooth}
and \ref{algebra-lemma-smooth-syntomic}.
\end{proof}

\begin{lemma}
\label{lemma-smooth-omega-finite-locally-free}
Let $f : X \to S$ be a morphism of schemes.
Assume $f$ is smooth.
Then the module of differentials $\Omega_{X/S}$ of $X$ over $S$
is finite locally free and
$$
\text{rank}_x(\Omega_{X/S}) = \dim_x(X_{f(x)})
$$
for every $x \in X$.
\end{lemma}

\begin{proof}
The statement is local on $X$ and $S$.
By Lemma \ref{lemma-smooth-locally-standard-smooth}
above we may assume that $f$ is a standard smooth morphism of affines.
In this case the result follows from
Algebra, Lemma \ref{algebra-lemma-standard-smooth}
(and the definition of a relative global complete intersection, see
Algebra,
Definition \ref{algebra-definition-relative-global-complete-intersection}).
\end{proof}

\noindent
Lemma \ref{lemma-smooth-omega-finite-locally-free}
says that the following definition makes sense.

\begin{definition}
\label{definition-smooth-relative-dimension}
Let $d \geq 0$ be an integer. We say a morphism of schemes $f : X \to S$
is {\it smooth of relative dimension $d$} if $f$ is smooth and
$\Omega_{X/S}$ is finite locally free of constant rank $d$.
\end{definition}

\noindent
In other words, $f$ is smooth and the nonempty fibres are equidimensional
of dimension $d$. By Lemma \ref{lemma-smooth-at-point} below this is also
the same as requiring: (a) $f$ is locally of finite presentation, (b) $f$ is
flat, (c) all nonempty fibres equidimensional of dimension $d$, and (d)
$\Omega_{X/S}$ finite locally free of rank $d$. It is not enough to simply
assume that $f$ is flat, of finite presentation, and $\Omega_{X/S}$ is
finite locally free of rank $d$. A counter example is given by
$\Spec(\mathbf{F}_p[t]) \to \Spec(\mathbf{F}_p[t^p])$.

\medskip\noindent
Here is a differential criterion of smoothness at a point.
There are many variants of this result
all of which may be useful at some point. We will just add them
here as needed.

\begin{lemma}
\label{lemma-smooth-at-point}
Let $f : X \to S$ be a morphism of schemes.
Let $x \in X$.
Set $s = f(x)$.
Assume $f$ is locally of finite presentation.
The following are equivalent:
\begin{enumerate}
\item The morphism $f$ is smooth at $x$.
\item The local ring map $\mathcal{O}_{S, s} \to \mathcal{O}_{X, x}$
is flat and $X_s \to \Spec(\kappa(s))$ is smooth at $x$.
\item The local ring map $\mathcal{O}_{S, s} \to \mathcal{O}_{X, x}$
is flat and the $\mathcal{O}_{X, x}$-module $\Omega_{X/S, x}$
can be generated by at most $\dim_x(X_{f(x)})$ elements.
\item The local ring map $\mathcal{O}_{S, s} \to \mathcal{O}_{X, x}$
is flat and the $\kappa(x)$-vector space
$$
\Omega_{X_s/s, x} \otimes_{\mathcal{O}_{X_s, x}} \kappa(x) =
\Omega_{X/S, x} \otimes_{\mathcal{O}_{X, x}} \kappa(x)
$$
can be generated by at most $\dim_x(X_{f(x)})$ elements.
\item There exist affine opens $U \subset X$,
and $V \subset S$ such that $x \in U$, $f(U) \subset V$ and the
induced morphism $f|_U : U \to V$ is standard smooth.
\item There exist affine opens $\Spec(A) = U \subset X$
and $\Spec(R) = V \subset S$ with $x \in U$ corresponding
to $\mathfrak q \subset A$, and $f(U) \subset V$
such that there exists a presentation
$$
A = R[x_1, \ldots, x_n]/(f_1, \ldots, f_c)
$$
with
$$
g =
\det
\left(
\begin{matrix}
\partial f_1/\partial x_1 &
\partial f_2/\partial x_1 &
\ldots &
\partial f_c/\partial x_1 \\
\partial f_1/\partial x_2 &
\partial f_2/\partial x_2 &
\ldots &
\partial f_c/\partial x_2 \\
\ldots & \ldots & \ldots & \ldots \\
\partial f_1/\partial x_c &
\partial f_2/\partial x_c &
\ldots &
\partial f_c/\partial x_c
\end{matrix}
\right)
$$
mapping to an element of $A$ not in $\mathfrak q$.
\end{enumerate}
\end{lemma}

\begin{proof}
Note that if $f$ is smooth at $x$, then we see from Lemma
\ref{lemma-smooth-locally-standard-smooth} that (5) holds, and (6) is a slightly
weakened version of (5). Moreover, $f$ smooth implies that the ring
map $\mathcal{O}_{S, s} \to \mathcal{O}_{X, x}$ is flat (see
Lemma \ref{lemma-smooth-flat}) and that $\Omega_{X/S}$ is
finite locally free of rank equal to
$\dim_x(X_s)$ (see Lemma \ref{lemma-smooth-omega-finite-locally-free}).
Thus (1) implies (3) and (4). By Lemma \ref{lemma-base-change-smooth}
we also see that (1) implies (2).

\medskip\noindent
By Lemma \ref{lemma-base-change-differentials}
the module of differentials $\Omega_{X_s/s}$ of the fibre $X_s$
over $\kappa(s)$ is the pullback of the module of differentials
$\Omega_{X/S}$ of $X$ over $S$. Hence the displayed equality in
part (4) of the lemma. By Lemma \ref{lemma-finite-type-differentials}
these modules are of finite type. Hence the minimal number of
generators of the modules
$\Omega_{X/S, x}$ and $\Omega_{X_s/s, x}$ is the same and equal to the
dimension of this $\kappa(x)$-vector space by Nakayama's Lemma
(Algebra, Lemma \ref{algebra-lemma-NAK}). This in particular shows that
(3) and (4) are equivalent.

\medskip\noindent
Algebra, Lemma \ref{algebra-lemma-flat-fibre-smooth} shows that
(2) implies (1).
Algebra, Lemma \ref{algebra-lemma-characterize-smooth-over-field}
shows that (3) and (4) imply (2). Finally, (6) implies (5)
see for example Algebra, Example \ref{algebra-example-make-standard-smooth}
and (5) implies (1) by Algebra, Lemma \ref{algebra-lemma-standard-smooth}.
\end{proof}

\begin{lemma}
\label{lemma-set-points-where-fibres-smooth}
Let
$$
\xymatrix{
X' \ar[r]_{g'} \ar[d]_{f'} & X \ar[d]^f \\
S' \ar[r]^g & S
}
$$
be a cartesian diagram of schemes. Let $W \subset X$, resp.\ $W' \subset X'$
be the open subscheme of points where $f$, resp.\ $f'$ is smooth.
Then $W' = (g')^{-1}(W)$ if
\begin{enumerate}
\item $f$ is flat and locally of finite presentation, or
\item $f$ is locally of finite presentation and $g$ is flat.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume first that $f$ locally of finite type. Consider the set
$$
T = \{x \in X \mid X_{f(x)}\text{ is smooth over }\kappa(f(x))\text{ at }x\}
$$
and the corresponding set $T' \subset X'$ for $f'$. Then we claim
$T' = (g')^{-1}(T)$. Namely, let $s' \in S'$ be a point, and let
$s = g(s')$. Then we have
$$
X'_{s'} =
\Spec(\kappa(s')) \times_{\Spec(\kappa(s))} X_s
$$
In other words the fibres of the base change are the base changes
of the fibres. Hence the claim is equivalent to
Algebra, Lemma \ref{algebra-lemma-smooth-field-change-local}.

\medskip\noindent
Thus case (1) follows because in case (1) $T$ is the (open) set of points
where $f$ is smooth by Lemma \ref{lemma-smooth-at-point}.

\medskip\noindent
In case (2) let $x' \in W'$. Then $g'$ is flat at $x'$
(Lemma \ref{lemma-base-change-module-flat}) and
$g \circ f$ is flat at $x'$ (Lemma \ref{lemma-composition-module-flat}).
It follows that $f$ is flat at $x = g'(x')$
by Lemma \ref{lemma-flat-permanence}. On the other hand, since
$x' \in T'$ (Lemma \ref{lemma-base-change-smooth})
we see that $x \in T$. Hence $f$ is smooth at $x$ by
Lemma \ref{lemma-smooth-at-point}.
\end{proof}

\noindent
Here is a lemma that actually uses the vanishing of $H^{-1}$
of the naive cotangent complex for a smooth ring map.

\begin{lemma}
\label{lemma-triangle-differentials-smooth}
Let $f : X \to Y$, $g : Y \to S$ be morphisms of schemes.
Assume $f$ is smooth. Then
$$
0 \to f^*\Omega_{Y/S} \to \Omega_{X/S} \to \Omega_{X/Y} \to 0
$$
(see Lemma \ref{lemma-triangle-differentials}) is short exact.
\end{lemma}

\begin{proof}
The algebraic version of this lemma is the following:
Given ring maps $A \to B \to C$ with $B \to C$ smooth, then the sequence
$$
0 \to C \otimes_B \Omega_{B/A} \to \Omega_{C/A} \to \Omega_{C/B} \to 0
$$
of
Algebra, Lemma \ref{algebra-lemma-exact-sequence-differentials}
is exact. This is
Algebra, Lemma \ref{algebra-lemma-triangle-differentials-smooth}.
\end{proof}

\begin{lemma}
\label{lemma-differentials-relative-immersion-smooth}
Let $i : Z \to X$ be an immersion of schemes over $S$.
Assume that $Z$ is smooth over $S$. Then the
canonical exact sequence
$$
0 \to \mathcal{C}_{Z/X} \to i^*\Omega_{X/S} \to \Omega_{Z/S} \to 0
$$
of
Lemma \ref{lemma-differentials-relative-immersion}
is short exact.
\end{lemma}

\begin{proof}
The algebraic version of this lemma is the following:
Given ring maps $A \to B \to C$ with $A \to C$ smooth and $B \to C$
surjective with kernel $J$, then the sequence
$$
0 \to J/J^2 \to C \otimes_B \Omega_{B/A} \to \Omega_{C/A} \to 0
$$
of
Algebra, Lemma \ref{algebra-lemma-differential-seq}
is exact. This is
Algebra, Lemma \ref{algebra-lemma-differential-seq-smooth}.
\end{proof}

\begin{lemma}
\label{lemma-two-immersions-smooth}
Let
$$
\xymatrix{
Z \ar[r]_i \ar[rd]_j & X \ar[d] \\
& Y
}
$$
be a commutative diagram of schemes where $i$ and $j$ are immersions
and $X \to Y$ is smooth.
Then the canonical exact sequence
$$
0 \to  \mathcal{C}_{Z/Y} \to \mathcal{C}_{Z/X} \to i^*\Omega_{X/Y} \to 0
$$
of
Lemma \ref{lemma-two-immersions}
is exact.
\end{lemma}

\begin{proof}
The algebraic version of this lemma is the following:
Given ring maps $A \to B \to C$ with $A \to C$ surjective and $A \to B$
smooth, then the sequence
$$
0 \to I/I^2 \to J/J^2 \to C \otimes_B \Omega_{B/A} \to 0
$$
of
Algebra, Lemma \ref{algebra-lemma-application-NL}
is exact. This is
Algebra, Lemma \ref{algebra-lemma-application-NL-smooth}.
\end{proof}

\begin{lemma}
\label{lemma-smooth-permanence}
Let
$$
\xymatrix{
X \ar[rr]_f \ar[rd]_p & &
Y \ar[dl]^q \\
& S
}
$$
be a commutative diagram of morphisms of schemes. Assume that
\begin{enumerate}
\item $f$ is surjective, and smooth,
\item $p$ is smooth, and
\item $q$ is locally of finite presentation\footnote{In fact this
is implied by (1) and (2), see
Descent, Lemma \ref{descent-lemma-flat-finitely-presented-permanence}.
Moreover, it suffices to assume $f$ is surjective, flat and locally
of finite presentation, see
Descent, Lemma \ref{descent-lemma-smooth-permanence}.}.
\end{enumerate}
Then $q$ is smooth.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-flat-permanence} we see that $q$ is flat.
Pick a point $y \in Y$. Pick a point $x \in X$ mapping to $y$.
Suppose $f$ has relative dimension $a$ at $x$ and $p$ has relative
dimension $b$ at $x$. By Lemma \ref{lemma-smooth-omega-finite-locally-free}
this means that $\Omega_{X/S, x}$ is free of rank $b$ and $\Omega_{X/Y, x}$
is free of rank $a$. By the short exact sequence
of Lemma \ref{lemma-triangle-differentials-smooth}
this means that $(f^*\Omega_{Y/S})_x$ is free
of rank $b - a$. By Nakayama's Lemma this implies that
$\Omega_{Y/S, y}$ can be generated by $b - a$ elements.
Also, by Lemma \ref{lemma-dimension-fibre-at-a-point-additive} we see that
$\dim_y(Y_s) = b - a$. Hence we conclude that
$Y \to S$ is smooth at $y$ by Lemma \ref{lemma-smooth-at-point} part (2).
\end{proof}

\noindent
In the situation of the following lemma the image of $\sigma$ is
locally on $X$ cut out by a regular sequence, see
Divisors, Lemma \ref{divisors-lemma-section-smooth-regular-immersion}.

\begin{lemma}
\label{lemma-section-smooth-morphism}
Let $f : X \to S$ be a morphism of schemes.
Let $\sigma : S \to X$ be a section of $f$.
Let $s \in S$ be a point such that $f$ is smooth at $x = \sigma(s)$.
Then there exist affine open neighbourhoods
$\Spec(A) = U \subset S$ of $s$ and $\Spec(B) = V \subset X$
of $x$ such that
\begin{enumerate}
\item $f(V) \subset U$ and $\sigma(U) \subset V$,
\item with $I = \Ker(\sigma^\# : B \to A)$ the module $I/I^2$
is a free $A$-module, and
\item $B^\wedge \cong A[[x_1, \ldots, x_d]]$ as $A$-algebras where
$B^\wedge$ denotes the completion of $B$ with respect to $I$.
\end{enumerate}
\end{lemma}

\begin{proof}
Pick an affine open $U \subset S$ containing $s$
Pick an affine open $V \subset f^{-1}(U)$ containing $x$.
Pick an affine open $U' \subset \sigma^{-1}(V)$ containing $s$.
Note that $V' = f^{-1}(U') \cap V$ is affine as it is equal to the
fibre product $V' = U' \times_U V$. Then $U'$ and $V'$ satisfy (1).
Write $U' = \Spec(A')$ and $V' = \Spec(B')$. By
Algebra, Lemma \ref{algebra-lemma-section-smooth}
the module $I'/(I')^2$ is finite locally free as a $A'$-module.
Hence after replacing $U'$ by a smaller affine open $U'' \subset U'$
and $V'$ by $V'' = V' \cap f^{-1}(U'')$ we obtain the situation where
$I''/(I'')^2$ is free, i.e., (2) holds. In this case (3) holds also by
Algebra, Lemma \ref{algebra-lemma-section-smooth}.
\end{proof}

\noindent
The dimension of a scheme $X$ at a point $x$
(Properties, Definition \ref{properties-definition-dimension})
is just the dimension of $X$ at $x$ as a topological space, see
Topology, Definition \ref{topology-definition-Krull}.
This is not the dimension of the local ring $\mathcal{O}_{X,x}$, in general.

\begin{lemma}
\label{lemma-smoothness-dimension}
Let $f : X \to Y$ be a smooth morphism of locally Noetherian schemes.
For every point $x$ in $X$ with image $y$ in $Y$,
$$
\dim_x(X) = \dim_y(Y) + \dim_x(X_y),
$$
where $X_y$ denotes the fiber over $y$.
\end{lemma}

\begin{proof}
After replacing $X$ by an open neighborhood of $x$,
there is a natural number $d$ such that all fibers
of $X \to Y$ have dimension $d$ at every point, see
Lemma \ref{lemma-smooth-omega-finite-locally-free}.
Then $f$ is flat (Lemma \ref{lemma-smooth-flat}),
locally of finite type (Lemma \ref{lemma-smooth-locally-finite-presentation}),
and of relative dimension $d$. Hence the result follows from
Lemma \ref{lemma-rel-dimension-dimension}.
\end{proof}












\section{Unramified morphisms}
\label{section-unramified}

\noindent
We briefly discuss unramified morphisms before the (perhaps) more interesting
class of \'etale morphisms. Recall that a ring map $R \to A$ is {\it unramified}
if it is of finite type and $\Omega_{A/R} = 0$ (this is the definition
of \cite{Henselian}). A ring map $R \to A$ is called {\it G-unramified} if it
is of finite presentation and $\Omega_{A/R} = 0$ (this is the definition of
\cite{EGA}). See
Algebra, Definition \ref{algebra-definition-unramified}.

\begin{definition}
\label{definition-unramified}
Let $f : X \to S$ be a morphism of schemes.
\begin{enumerate}
\item We say that $f$ is {\it unramified at $x \in X$} if
there exists an affine open neighbourhood $\Spec(A) = U \subset X$
of $x$ and affine open $\Spec(R) = V \subset S$
with $f(U) \subset V$ such that the induced ring map
$R \to A$ is unramified.
\item We say that $f$ is {\it G-unramified at $x \in X$} if
there exists an affine open neighbourhood $\Spec(A) = U \subset X$
of $x$ and affine open $\Spec(R) = V \subset S$
with $f(U) \subset V$ such that the induced ring map
$R \to A$ is G-unramified.
\item We say that $f$ is {\it unramified} if it is unramified
at every point of $X$.
\item We say that $f$ is {\it G-unramified} if it is G-unramified
at every point of $X$.
\end{enumerate}
\end{definition}

\noindent
Note that a G-unramified morphism is unramified. Hence any result for
unramified morphisms implies the corresponding result for G-unramified
morphisms. Moreover, if $S$ is locally Noetherian then there is no difference
between G-unramified and unramified morphisms, see
Lemma \ref{lemma-noetherian-unramified}.
A pleasing feature of this definition is that the set of points
where a morphism is unramified (resp.\ G-unramified) is automatically open.

\begin{lemma}
\label{lemma-unramified-omega-zero}
Let $f : X \to S$ be a morphism of schemes. Then
\begin{enumerate}
\item $f$ is unramified if and only if $f$ is locally of finite type
and $\Omega_{X/S} = 0$, and
\item $f$ is G-unramified if and only if $f$ is locally of finite presentation
and $\Omega_{X/S} = 0$.
\end{enumerate}
\end{lemma}

\begin{proof}
By definition a ring map $R \to A$ is unramified (resp.\ G-unramified)
if and only if it is of finite type (resp.\ finite presentation)
and $\Omega_{A/R} = 0$. Hence the lemma follows
directly from the definitions and Lemma \ref{lemma-differentials-affine}.
\end{proof}

\noindent
Note that there is no separation or quasi-compactness hypotheses in the
definition. Hence the question of being unramified is local in nature on
the source. Here is the precise result.

\begin{lemma}
\label{lemma-unramified-characterize}
Let $f : X \to S$ be a morphism of schemes.
The following are equivalent
\begin{enumerate}
\item The morphism $f$ is unramified (resp.\ G-unramified).
\item For every affine open $U \subset X$, $V \subset S$
with $f(U) \subset V$ the ring map
$\mathcal{O}_S(V) \to \mathcal{O}_X(U)$ is unramified (resp.\ G-unramified).
\item There exists an open covering $S = \bigcup_{j \in J} V_j$
and open coverings $f^{-1}(V_j) = \bigcup_{i \in I_j} U_i$ such
that each of the morphisms $U_i \to V_j$, $j\in J, i\in I_j$
is unramified (resp.\ G-unramified).
\item There exists an affine open covering $S = \bigcup_{j \in J} V_j$
and affine open coverings $f^{-1}(V_j) = \bigcup_{i \in I_j} U_i$ such
that the ring map $\mathcal{O}_S(V_j) \to \mathcal{O}_X(U_i)$ is
unramified (resp.\ G-unramified), for all $j\in J, i\in I_j$.
\end{enumerate}
Moreover, if $f$ is unramified (resp.\ G-unramified) then for
any open subschemes $U \subset X$, $V \subset S$ with $f(U) \subset V$
the restriction $f|_U : U \to V$ is unramified (resp.\ G-unramified).
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-locally-P} if we show that
the property ``$R \to A$ is unramified'' is local.
We check conditions (a), (b) and (c) of Definition
\ref{definition-property-local}.
These properties are proved in
Algebra, Lemma \ref{algebra-lemma-unramified}.
\end{proof}

\begin{lemma}
\label{lemma-composition-unramified}
The composition of two morphisms which are unramified is unramified.
The same holds for G-unramified morphisms.
\end{lemma}

\begin{proof}
The proof of Lemma \ref{lemma-unramified-characterize}
shows that being unramified (resp.\ G-unramified)
is a local property of ring maps.
Hence the first statement of the lemma follows from
Lemma \ref{lemma-composition-type-P} combined
with the fact that being unramified (resp.\ G-unramified)
is a property of ring maps that is stable under composition, see
Algebra, Lemma \ref{algebra-lemma-unramified}.
\end{proof}

\begin{lemma}
\label{lemma-base-change-unramified}
The base change of a morphism which is unramified is unramified.
The same holds for G-unramified morphisms.
\end{lemma}

\begin{proof}
The proof of Lemma \ref{lemma-unramified-characterize}
shows that being unramified (resp.\ G-unramified)
is a local property of ring maps. Hence the lemma follows from
Lemma \ref{lemma-base-change-type-P} combined
with the fact that being unramified (resp.\ G-unramified)
is a property of ring maps that is stable under base change, see
Algebra, Lemma \ref{algebra-lemma-unramified}.
\end{proof}

\begin{lemma}
\label{lemma-noetherian-unramified}
Let $f : X \to S$ be a morphism of schemes. Assume $S$ is locally Noetherian.
Then $f$ is unramified if and only if $f$ is G-unramified.
\end{lemma}

\begin{proof}
Follows from the definitions and
Lemma \ref{lemma-noetherian-finite-type-finite-presentation}.
\end{proof}


\begin{lemma}
\label{lemma-open-immersion-unramified}
Any open immersion is G-unramified.
\end{lemma}

\begin{proof}
This is true because an open immersion is a local isomorphism.
\end{proof}

\begin{lemma}
\label{lemma-closed-immersion-unramified}
A closed immersion $i : Z \to X$ is unramified.
It is G-unramified if and only if the associated quasi-coherent sheaf of
ideals $\mathcal{I} = \Ker(\mathcal{O}_X \to i_*\mathcal{O}_Z)$
is of finite type (as an $\mathcal{O}_X$-module).
\end{lemma}

\begin{proof}
Follows from Lemma \ref{lemma-closed-immersion-finite-presentation} and
Algebra, Lemma \ref{algebra-lemma-unramified}.
\end{proof}

\begin{lemma}
\label{lemma-unramified-locally-finite-type}
An unramified morphism is locally of finite type.
A G-unramified morphism is locally of finite presentation.
\end{lemma}

\begin{proof}
An unramified ring map is of finite type by definition.
A G-unramified ring map is of finite presentation by definition.
\end{proof}

\begin{lemma}
\label{lemma-unramified-quasi-finite}
Let $f : X \to S$ be a morphism of schemes.
If $f$ is unramified at $x$ then $f$ is quasi-finite at $x$.
In particular, an unramified morphism is locally quasi-finite.
\end{lemma}

\begin{proof}
See Algebra, Lemma \ref{algebra-lemma-unramified-quasi-finite}.
\end{proof}

\begin{lemma}
\label{lemma-unramified-over-field}
Fibres of unramified morphisms.
\begin{enumerate}
\item Let $X$ be a scheme over a field $k$.
The structure morphism $X \to \Spec(k)$ is unramified if
and only if $X$ is a disjoint union of spectra of finite separable
field extensions of $k$.
\item If $f : X \to S$ is an unramified morphism then for every $s \in S$
the fibre $X_s$ is a disjoint union of spectra of finite separable field
extensions of $\kappa(s)$.
\end{enumerate}
\end{lemma}

\begin{proof}
Part (2) follows from part (1) and
Lemma \ref{lemma-base-change-unramified}.
Let us prove part (1).
We first use Algebra, Lemma \ref{algebra-lemma-characterize-unramified}.
This lemma implies that if $X$ is a disjoint union of spectra of finite
separable field extensions of $k$ then $X \to \Spec(k)$ is unramified.
Conversely, suppose that $X \to \Spec(k)$ is unramified.
By Algebra, Lemma \ref{algebra-lemma-unramified-at-prime} for every $x \in X$
the residue field extension $\kappa(x)/k$ is
finite separable. Since $X \to \Spec(k)$ is locally
quasi-finite (Lemma \ref{lemma-unramified-quasi-finite})
we see that all points of $X$ are isolated closed points, see
Lemma \ref{lemma-quasi-finite-at-point-characterize}.
Thus $X$ is a discrete space, in particular the disjoint union
of the spectra of its local rings. By
Algebra, Lemma \ref{algebra-lemma-unramified-at-prime} again these
local rings are fields, and we win.
\end{proof}

\noindent
The following lemma characterizes an unramified morphisms as
morphisms locally of finite type with unramified fibres.

\begin{lemma}
\label{lemma-unramified-etale-fibres}
Let $f : X \to S$ be a morphism of schemes.
\begin{enumerate}
\item If $f$ is unramified then for any $x \in X$ the field extension
$\kappa(x)/\kappa(f(x))$ is finite separable.
\item If $f$ is locally of finite type, and for every
$s \in S$ the fibre $X_s$ is a disjoint union of spectra of finite separable
field extensions of $\kappa(s)$ then $f$ is unramified.
\item If $f$ is locally of finite presentation, and for every
$s \in S$ the fibre $X_s$ is a disjoint union of spectra of finite separable
field extensions of $\kappa(s)$ then $f$ is G-unramified.
\end{enumerate}
\end{lemma}

\begin{proof}
Follows from Algebra, Lemmas
\ref{algebra-lemma-unramified-at-prime} and
\ref{algebra-lemma-characterize-unramified}.
\end{proof}

\noindent
Here is a characterization of unramified morphisms in terms of the
diagonal morphism.

\begin{lemma}
\label{lemma-diagonal-unramified-morphism}
Let $f : X \to S$ be a morphism.
\begin{enumerate}
\item If $f$ is unramified, then the diagonal morphism
$\Delta : X \to X \times_S X$ is an open immersion.
\item If $f$ is locally of finite type
and $\Delta$ is an open immersion, then $f$ is unramified.
\item If $f$ is locally of finite presentation and $\Delta$ is an open
immersion, then $f$ is G-unramified.
\end{enumerate}
\end{lemma}

\begin{proof}
The first statement follows from
Algebra, Lemma \ref{algebra-lemma-diagonal-unramified}.
The second statement from the fact that $\Omega_{X/S}$
is the conormal sheaf of the diagonal morphism
(Lemma \ref{lemma-differentials-diagonal})
and hence clearly zero if $\Delta$ is an open immersion.
\end{proof}

\begin{lemma}
\label{lemma-unramified-at-point}
Let $f : X \to S$ be a morphism of schemes.
Let $x \in X$.
Set $s = f(x)$.
Assume $f$ is locally of finite type (resp.\ locally of finite presentation).
The following are equivalent:
\begin{enumerate}
\item The morphism $f$ is unramified (resp.\ G-unramified) at $x$.
\item The fibre $X_s$ is unramified over $\kappa(s)$ at $x$.
\item The $\mathcal{O}_{X, x}$-module $\Omega_{X/S, x}$ is zero.
\item The $\mathcal{O}_{X_s, x}$-module $\Omega_{X_s/s, x}$ is zero.
\item The $\kappa(x)$-vector space
$$
\Omega_{X_s/s, x} \otimes_{\mathcal{O}_{X_s, x}} \kappa(x) =
\Omega_{X/S, x} \otimes_{\mathcal{O}_{X, x}} \kappa(x)
$$
is zero.
\item We have $\mathfrak m_s\mathcal{O}_{X, x} = \mathfrak m_x$
and the field extension $\kappa(x)/\kappa(s)$ is finite
separable.
\end{enumerate}
\end{lemma}

\begin{proof}
Note that if $f$ is unramified at $x$, then
we see that $\Omega_{X/S} = 0$ in a neighbourhood of $x$
by the definitions and the results on modules of differentials
in Section \ref{section-sheaf-differentials}. Hence (1) implies
(3) and the vanishing of the right hand vector space in (5).
It also implies (2) because by
Lemma \ref{lemma-base-change-differentials}
the module of differentials $\Omega_{X_s/s}$ of the fibre $X_s$
over $\kappa(s)$ is the pullback of the module of differentials
$\Omega_{X/S}$ of $X$ over $S$. This fact on modules of differentials
also implies the displayed equality of vector spaces in part (4). By
Lemma \ref{lemma-finite-type-differentials}
the modules $\Omega_{X/S, x}$ and $\Omega_{X_s/s, x}$ are of finite type.
Hence the modules $\Omega_{X/S, x}$ and $\Omega_{X_s/s, x}$ are zero if and only
if the corresponding $\kappa(x)$-vector space in (4) is zero by
Nakayama's Lemma
(Algebra, Lemma \ref{algebra-lemma-NAK}).
This in particular shows that (3), (4) and (5) are equivalent.
The support of $\Omega_{X/S}$ is closed in $X$, see
Modules, Lemma \ref{modules-lemma-support-finite-type-closed}.
Assumption (3) implies that $x$ is not in the support.
Hence $\Omega_{X/S}$ is zero in a neighbourhood of $x$, which
implies (1). The equivalence of (1) and (3) applied to $X_s \to s$
implies the equivalence of (2) and (4).
At this point we have seen that (1) -- (5) are equivalent.

\medskip\noindent
Alternatively you can use Algebra, Lemma \ref{algebra-lemma-unramified}
to see the equivalence of (1) -- (5) more directly.

\medskip\noindent
The equivalence of (1) and (6) follows from Lemma
\ref{lemma-unramified-etale-fibres}.
It also follows more directly from
Algebra, Lemmas \ref{algebra-lemma-unramified-at-prime} and
\ref{algebra-lemma-characterize-unramified}.
\end{proof}

\begin{lemma}
\label{lemma-set-points-where-fibres-unramified}
Let $f : X \to S$ be a morphism of schemes.
Assume $f$ locally of finite type. Formation of the open set
\begin{align*}
T
& =
\{x \in X \mid X_{f(x)}\text{ is unramified over }\kappa(f(x))\text{ at }x\} \\
& =
\{x \in X \mid X\text{ is unramified over }S\text{ at }x\}
\end{align*}
commutes with arbitrary base change:
For any morphism $g : S' \to S$, consider
the base change $f' : X' \to S'$ of $f$ and the
projection $g' : X' \to X$. Then the corresponding
set $T'$ for the morphism $f'$ is equal to $T' = (g')^{-1}(T)$.
If $f$ is assumed locally of finite presentation then the same holds
for the open set of points where $f$ is G-unramified.
\end{lemma}

\begin{proof}
Let $s' \in S'$ be a point, and let $s = g(s')$. Then we have
$$
X'_{s'} =
\Spec(\kappa(s')) \times_{\Spec(\kappa(s))} X_s
$$
In other words the fibres of the base change are the base changes
of the fibres. In particular
$$
\Omega_{X_s/s, x} \otimes_{\mathcal{O}_{X_s, x}} \kappa(x')
=
\Omega_{X'_{s'}/s', x'} \otimes_{\mathcal{O}_{X'_{s'}, x'}} \kappa(x')
$$
see
Lemma \ref{lemma-base-change-differentials}.
Whence $x' \in T'$ if and only if $x \in T$ by
Lemma \ref{lemma-unramified-at-point}.
The second part follows from the first because in that case
$T$ is the (open) set of points where $f$ is G-unramified according to
Lemma \ref{lemma-unramified-at-point}.
\end{proof}

\begin{lemma}
\label{lemma-unramified-permanence}
Let $f : X \to Y$ be a morphism of schemes over $S$.
\begin{enumerate}
\item If $X$ is unramified over $S$, then $f$ is unramified.
\item If $X$ is G-unramified over $S$ and $Y$ is locally of finite type
over $S$, then $f$ is G-unramified.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume that $X$ is unramified over $S$.
By Lemma \ref{lemma-permanence-finite-type} we see that $f$
is locally of finite type.
By assumption we have $\Omega_{X/S} = 0$. Hence
$\Omega_{X/Y} = 0$ by Lemma \ref{lemma-triangle-differentials}. Thus
$f$ is unramified. If $X$ is G-unramified over $S$ and $Y$ is locally of
finite type over $S$, then by
Lemma \ref{lemma-finite-presentation-permanence}
we see that $f$ is locally of finite presentation and we conclude
that $f$ is G-unramified.
\end{proof}

\begin{lemma}
\label{lemma-value-at-one-point}
Let $S$ be a scheme.
Let $X$, $Y$ be schemes over $S$.
Let $f, g : X \to Y$ be morphisms over $S$. Let $x \in X$.
Assume that
\begin{enumerate}
\item the structure morphism $Y \to S$ is unramified,
\item $f(x) = g(x)$ in $Y$, say $y = f(x) = g(x)$, and
\item the induced maps $f^\sharp, g^\sharp : \kappa(y) \to \kappa(x)$
are equal.
\end{enumerate}
Then there exists an open neighbourhood of $x$ in $X$ on which
$f$ and $g$ are equal.
\end{lemma}

\begin{proof}
Consider the morphism $(f, g) : X \to Y \times_S Y$. By assumption (1) and
Lemma \ref{lemma-diagonal-unramified-morphism}
the inverse image of $\Delta_{Y/S}(Y)$ is open in $X$.
And assumptions (2) and (3) imply that $x$ is in this open subset.
\end{proof}










\section{\'Etale morphisms}
\label{section-etale}

\noindent
The Zariski topology of a scheme is a very coarse topology.
This is particularly clear when looking at varieties over $\mathbf{C}$.
It turns out that declaring an \'etale morphism to be the analogue of a
local isomorphism in topology introduces a much finer topology. On
varieties over $\mathbf{C}$ this topology gives rise to the ``correct'' Betti
numbers when computing cohomology with finite coefficients. Another
observable is that if $f : X \to Y$ is an \'etale morphism of varieties over
$\mathbf{C}$, and if $x$ is a closed point of $X$, then
$f$ induces an isomorphism
$\mathcal{O}^{\wedge}_{Y, f(x)} \to \mathcal{O}^{\wedge}_{X, x}$
of complete local rings.

\medskip\noindent
In this section we start our study of these matters. In fact we deliberately
restrict our discussion to a minimum since we will discuss more interesting
results elsewhere. Recall that a ring map $R \to A$ is said to be {\it \'etale}
if it is smooth and $\Omega_{A/R} = 0$, see
Algebra, Definition \ref{algebra-definition-etale}.

\begin{definition}
\label{definition-etale}
Let $f : X \to S$ be a morphism of schemes.
\begin{enumerate}
\item We say that $f$ is {\it \'etale at $x \in X$} if
there exists an affine open neighbourhood $\Spec(A) = U \subset X$
of $x$ and affine open $\Spec(R) = V \subset S$
with $f(U) \subset V$ such that the induced ring map
$R \to A$ is \'etale.
\item We say that $f$ is {\it \'etale} if it is \'etale at every point of $X$.
\item A morphism of affine schemes $f : X \to S$ is called
{\it standard \'etale} if $X \to S$ is isomorphic to
$$
\Spec(R[x]_h/(g)) \to \Spec(R)
$$
where $R \to R[x]_h/(g)$ is a standard \'etale ring map, see
Algebra, Definition \ref{algebra-definition-standard-etale},
i.e., $g$ is monic and $g'$ invertible in $R[x]_h/(g)$.
\end{enumerate}
\end{definition}

\noindent
A morphism is \'etale if and only if it is smooth of relative dimension $0$
(see Definition \ref{definition-smooth-relative-dimension}).
A pleasing feature of the definition is that the set of points
where a morphism is \'etale is automatically open.

\medskip\noindent
Note that there is no separation or quasi-compactness hypotheses in the
definition. Hence the question of being \'etale is local in nature on
the source. Here is the precise result.

\begin{lemma}
\label{lemma-etale-characterize}
Let $f : X \to S$ be a morphism of schemes.
The following are equivalent
\begin{enumerate}
\item The morphism $f$ is \'etale.
\item For every affine opens $U \subset X$, $V \subset S$
with $f(U) \subset V$ the ring map
$\mathcal{O}_S(V) \to \mathcal{O}_X(U)$ is \'etale.
\item There exists an open covering $S = \bigcup_{j \in J} V_j$
and open coverings $f^{-1}(V_j) = \bigcup_{i \in I_j} U_i$ such
that each of the morphisms $U_i \to V_j$, $j\in J, i\in I_j$
is \'etale.
\item There exists an affine open covering $S = \bigcup_{j \in J} V_j$
and affine open coverings $f^{-1}(V_j) = \bigcup_{i \in I_j} U_i$ such
that the ring map $\mathcal{O}_S(V_j) \to \mathcal{O}_X(U_i)$ is
\'etale, for all $j\in J, i\in I_j$.
\end{enumerate}
Moreover, if $f$ is \'etale then for
any open subschemes $U \subset X$, $V \subset S$ with $f(U) \subset V$
the restriction $f|_U : U \to V$ is \'etale.
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-locally-P} if we show that
the property ``$R \to A$ is \'etale'' is local.
We check conditions (a), (b) and (c) of Definition
\ref{definition-property-local}.
These all follow from Algebra, Lemma \ref{algebra-lemma-etale}.
\end{proof}

\begin{lemma}
\label{lemma-composition-etale}
The composition of two morphisms which are \'etale is \'etale.
\end{lemma}

\begin{proof}
In the proof of Lemma \ref{lemma-etale-characterize}
we saw that being \'etale is a local property of ring maps.
Hence the first statement of the lemma follows from
Lemma \ref{lemma-composition-type-P} combined
with the fact that being \'etale is a property of ring maps that is
stable under composition, see
Algebra, Lemma \ref{algebra-lemma-etale}.
\end{proof}

\begin{lemma}
\label{lemma-base-change-etale}
The base change of a morphism which is \'etale is \'etale.
\end{lemma}

\begin{proof}
In the proof of Lemma \ref{lemma-etale-characterize}
we saw that being \'etale is a local property of ring maps.
Hence the lemma follows from
Lemma \ref{lemma-composition-type-P} combined
with the fact that being \'etale is a property of ring maps that is
stable under base change, see
Algebra, Lemma \ref{algebra-lemma-etale}.
\end{proof}

\begin{lemma}
\label{lemma-etale-smooth-unramified}
Let $f : X \to S$ be a morphism of schemes.
Let $x \in X$. Then $f$ is \'etale at $x$ if and only if $f$ is
smooth and unramified at $x$.
\end{lemma}

\begin{proof}
This follows immediately from the definitions.
\end{proof}

\begin{lemma}
\label{lemma-etale-locally-quasi-finite}
An \'etale morphism is locally quasi-finite.
\end{lemma}

\begin{proof}
By
Lemma \ref{lemma-etale-smooth-unramified}
an \'etale morphism is unramified. By
Lemma \ref{lemma-unramified-quasi-finite}
an unramified morphism is locally quasi-finite.
\end{proof}

\begin{lemma}
\label{lemma-etale-over-field}
\begin{slogan}
Description of the \'etale schemes over fields and fibres
of \'etale morphisms.
\end{slogan}
Fibres of \'etale morphisms.
\begin{enumerate}
\item Let $X$ be a scheme over a field $k$.
The structure morphism $X \to \Spec(k)$ is \'etale if
and only if $X$ is a disjoint union of spectra of finite separable
field extensions of $k$.
\item If $f : X \to S$ is an \'etale morphism, then for every $s \in S$ the
fibre $X_s$ is a disjoint union of spectra of finite separable field
extensions of $\kappa(s)$.
\end{enumerate}
\end{lemma}

\begin{proof}
You can deduce this from Lemma \ref{lemma-unramified-over-field}
via Lemma \ref{lemma-etale-smooth-unramified} above.
Here is a direct proof.

\medskip\noindent
We will use Algebra, Lemma \ref{algebra-lemma-etale-over-field}.
Hence it is clear that if $X$ is a disjoint union of spectra of finite
separable field extensions of $k$ then $X \to \Spec(k)$ is \'etale.
Conversely, suppose that $X \to \Spec(k)$ is \'etale. Then for any affine
open $U \subset X$ we see that $U$ is a finite disjoint union of spectra
of finite separable field extensions of $k$. Hence all points of $X$
are closed points (see
Lemma \ref{lemma-algebraic-residue-field-extension-closed-point-fibre}
for example). Thus $X$ is a discrete space and we win.
\end{proof}

\noindent
The following lemma characterizes an \'etale morphism as a
flat, finitely presented morphism with ``\'etale fibres''.

\begin{lemma}
\label{lemma-etale-flat-etale-fibres}
Let $f : X \to S$ be a morphism of schemes.
If $f$ is flat, locally of finite presentation, and for every $s \in S$
the fibre $X_s$ is a disjoint union of spectra of finite separable
field extensions of $\kappa(s)$, then $f$ is \'etale.
\end{lemma}

\begin{proof}
You can deduce this from
Algebra, Lemma \ref{algebra-lemma-characterize-etale}.
Here is another proof.

\medskip\noindent
By Lemma \ref{lemma-etale-over-field} a fibre $X_s$ is \'etale
and hence smooth over $s$. By Lemma \ref{lemma-smooth-flat-smooth-fibres}
we see that $X \to S$ is smooth.
By Lemma \ref{lemma-unramified-etale-fibres}
we see that $f$ is unramified. We conclude by
Lemma \ref{lemma-etale-smooth-unramified}.
\end{proof}

\begin{lemma}
\label{lemma-open-immersion-etale}
Any open immersion is \'etale.
\end{lemma}

\begin{proof}
This is true because an open immersion is a local isomorphism.
\end{proof}

\begin{lemma}
\label{lemma-etale-syntomic}
An \'etale morphism is syntomic.
\end{lemma}

\begin{proof}
See Algebra, Lemma \ref{algebra-lemma-smooth-syntomic} and use that an
\'etale morphism is the same as a smooth morphism of relative dimension $0$.
\end{proof}

\begin{lemma}
\label{lemma-etale-locally-finite-presentation}
An \'etale morphism is locally of finite presentation.
\end{lemma}

\begin{proof}
True because an \'etale ring map is of finite presentation by
definition.
\end{proof}

\begin{lemma}
\label{lemma-etale-flat}
An \'etale morphism is flat.
\end{lemma}

\begin{proof}
Combine Lemmas \ref{lemma-syntomic-flat} and \ref{lemma-etale-syntomic}.
\end{proof}

\begin{lemma}
\label{lemma-etale-open}
An \'etale morphism is open.
\end{lemma}

\begin{proof}
Combine Lemmas \ref{lemma-etale-flat},
\ref{lemma-etale-locally-finite-presentation}, and
\ref{lemma-fppf-open}.
\end{proof}

\noindent
The following lemma says locally any \'etale morphism is standard \'etale.
This is actually kind of a tricky result to prove in complete generality.
The tricky parts are hidden in the chapter on commutative algebra.
Hence a standard \'etale morphism is a {\it local model} for a general
\'etale morphism.

\begin{lemma}
\label{lemma-etale-locally-standard-etale}
Let $f : X  \to S$ be a morphism of schemes.
Let $x \in X$ be a point.
Let $V \subset S$ be an affine open neighbourhood of $f(x)$.
The following are equivalent
\begin{enumerate}
\item The morphism $f$ is \'etale at $x$.
\item There exist an affine open $U \subset X$ with
$x \in U$ and $f(U) \subset V$ such that the
induced morphism $f|_U : U \to V$ is standard \'etale
(see Definition \ref{definition-etale}).
\end{enumerate}
\end{lemma}

\begin{proof}
Follows from the definitions and
Algebra, Proposition \ref{algebra-proposition-etale-locally-standard}.
\end{proof}

\noindent
Here is a differential criterion of \'etaleness at a point.
There are many variants of this result
all of which may be useful at some point. We will just add them
here as needed.

\begin{lemma}
\label{lemma-etale-at-point}
Let $f : X \to S$ be a morphism of schemes.
Let $x \in X$.
Set $s = f(x)$.
Assume $f$ is locally of finite presentation.
The following are equivalent:
\begin{enumerate}
\item The morphism $f$ is \'etale at $x$.
\item The local ring map $\mathcal{O}_{S, s} \to \mathcal{O}_{X, x}$
is flat and $X_s \to \Spec(\kappa(s))$ is \'etale at $x$.
\item The local ring map $\mathcal{O}_{S, s} \to \mathcal{O}_{X, x}$
is flat and $X_s \to \Spec(\kappa(s))$ is unramified at $x$.
\item The local ring map $\mathcal{O}_{S, s} \to \mathcal{O}_{X, x}$
is flat and the $\mathcal{O}_{X, x}$-module $\Omega_{X/S, x}$
is zero.
\item The local ring map $\mathcal{O}_{S, s} \to \mathcal{O}_{X, x}$
is flat and the $\kappa(x)$-vector space
$$
\Omega_{X_s/s, x} \otimes_{\mathcal{O}_{X_s, x}} \kappa(x) =
\Omega_{X/S, x} \otimes_{\mathcal{O}_{X, x}} \kappa(x)
$$
is zero.
\item The local ring map $\mathcal{O}_{S, s} \to \mathcal{O}_{X, x}$
is flat, we have $\mathfrak m_s\mathcal{O}_{X, x} = \mathfrak m_x$ and
the field extension $\kappa(x)/\kappa(s)$ is finite
separable.
\item There exist affine opens $U \subset X$,
and $V \subset S$ such that $x \in U$, $f(U) \subset V$ and the
induced morphism $f|_U : U \to V$ is standard smooth
of relative dimension $0$.
\item There exist affine opens $\Spec(A) = U \subset X$
and $\Spec(R) = V \subset S$ with $x \in U$ corresponding
to $\mathfrak q \subset A$, and $f(U) \subset V$
such that there exists a presentation
$$
A = R[x_1, \ldots, x_n]/(f_1, \ldots, f_n)
$$
with
$$
g =
\det
\left(
\begin{matrix}
\partial f_1/\partial x_1 &
\partial f_2/\partial x_1 &
\ldots &
\partial f_n/\partial x_1 \\
\partial f_1/\partial x_2 &
\partial f_2/\partial x_2 &
\ldots &
\partial f_n/\partial x_2 \\
\ldots & \ldots & \ldots & \ldots \\
\partial f_1/\partial x_n &
\partial f_2/\partial x_n &
\ldots &
\partial f_n/\partial x_n
\end{matrix}
\right)
$$
mapping to an element of $A$ not in $\mathfrak q$.
\item There exist affine opens $U \subset X$,
and $V \subset S$ such that $x \in U$, $f(U) \subset V$ and the
induced morphism $f|_U : U \to V$ is standard \'etale.
\item There exist affine opens $\Spec(A) = U \subset X$
and $\Spec(R) = V \subset S$ with $x \in U$ corresponding
to $\mathfrak q \subset A$, and $f(U) \subset V$
such that there exists a presentation
$$
A = R[x]_Q/(P) = R[x, 1/Q]/(P)
$$
with $P, Q \in R[x]$, $P$ monic and $P' = \text{d}P/\text{d}x$ mapping to
an element of $A$ not in $\mathfrak q$.
\end{enumerate}
\end{lemma}

\begin{proof}
Use Lemma \ref{lemma-etale-locally-standard-etale}
and the definitions to see that (1) implies all
of the other conditions. For each of the conditions
(2) -- (10) combine Lemmas \ref{lemma-smooth-at-point}
and \ref{lemma-unramified-at-point} to see
that (1) holds by showing $f$ is both smooth and unramified
at $x$ and applying Lemma \ref{lemma-etale-smooth-unramified}.
Some details omitted.
\end{proof}

\begin{lemma}
\label{lemma-flat-unramified-etale}
A morphism is \'etale at a point if and only if it is flat and G-unramified
at that point.
A morphism is \'etale if and only if it is flat and G-unramified.
\end{lemma}

\begin{proof}
This is clear from Lemmas \ref{lemma-etale-at-point}
and \ref{lemma-unramified-at-point}.
\end{proof}

\begin{lemma}
\label{lemma-set-points-where-fibres-etale}
Let
$$
\xymatrix{
X' \ar[r]_{g'} \ar[d]_{f'} & X \ar[d]^f \\
S' \ar[r]^g & S
}
$$
be a cartesian diagram of schemes. Let $W \subset X$, resp.\ $W' \subset X'$
be the open subscheme of points where $f$, resp.\ $f'$ is \'etale.
Then $W' = (g')^{-1}(W)$ if
\begin{enumerate}
\item $f$ is flat and locally of finite presentation, or
\item $f$ is locally of finite presentation and $g$ is flat.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume first that $f$ locally of finite type. Consider the set
$$
T = \{x \in X \mid f\text{ is unramified at }x\}
$$
and the corresponding set $T' \subset X'$ for $f'$. Then
$T' = (g')^{-1}(T)$ by
Lemma \ref{lemma-set-points-where-fibres-unramified}.

\medskip\noindent
Thus case (1) follows because in case (1) $T$ is the (open) set of points
where $f$ is \'etale by Lemma \ref{lemma-flat-unramified-etale}.

\medskip\noindent
In case (2) let $x' \in W'$. Then $g'$ is flat at $x'$
(Lemma \ref{lemma-base-change-module-flat}) and
$g \circ f'$ is flat at $x'$ (Lemma \ref{lemma-composition-module-flat}).
It follows that $f$ is flat at $x = g'(x')$
by Lemma \ref{lemma-flat-permanence}. On the other hand, since
$x' \in T'$ (Lemma \ref{lemma-base-change-smooth})
we see that $x \in T$. Hence $f$ is \'etale at $x$ by
Lemma \ref{lemma-etale-at-point}.
\end{proof}

\begin{lemma}
\label{lemma-etale-permanence}
\begin{slogan}
Cancellation law for \'etale morphisms
\end{slogan}
Let $f : X \to Y$ be a morphism of schemes over $S$.
If $X$ and $Y$ are \'etale over $S$, then
$f$ is \'etale.
\end{lemma}

\begin{proof}
As a first proof one may reduce to the affine case and then use
Algebra, Lemma \ref{algebra-lemma-map-between-etale}. This proof is
somewhat complicated as it uses the ``Crit\`ere de platitude par fibres''
to see that a morphism $X \to Y$ over $S$ between schemes \'etale over $S$
is automatically flat.

\medskip\noindent
We give a second proof using the graph argument. Namely, consider the
factorization $X \to X \times_S Y \to Y$, where the first arrow
is given by $\text{id}_X$ and $f$ and the second arrow is the projection.
We claim both arrows are \'etale and hence $f$ is \'etale by
Lemma \ref{lemma-composition-etale}. Namely, the projection is \'etale
as it is the base change of $X \to S$, see Lemma \ref{lemma-base-change-etale}.
The first arrow is the base change of the diagonal morphism
$Y \to Y \times_S Y$ because the square
$$
\xymatrix{
X \ar[d] \ar[r] & X \times_S Y \ar[d] \\
Y \ar[r] & Y \times_S Y
}
$$
is cartesian. The diagonal $Y \to Y \times_S Y$ is an open immersion
because $Y \to S$ is \'etale and hence unramified
(Lemma \ref{lemma-etale-smooth-unramified}) and we may use
Lemma \ref{lemma-diagonal-unramified-morphism}. The base change
of an open immersion is an open immersion
(Schemes, Lemma \ref{schemes-lemma-base-change-immersion})
and an open immersion is \'etale
(Lemma \ref{lemma-open-immersion-etale}). This finishes the second proof.
\end{proof}

\begin{lemma}
\label{lemma-etale-permanence-two}
Let
$$
\xymatrix{
X \ar[rr]_f \ar[rd]_p & &
Y \ar[dl]^q \\
& S
}
$$
be a commutative diagram of morphisms of schemes. Assume that
\begin{enumerate}
\item $f$ is surjective, and \'etale,
\item $p$ is \'etale, and
\item $q$ is locally of finite presentation\footnote{In fact this
is implied by (1) and (2), see
Descent, Lemma \ref{descent-lemma-flat-finitely-presented-permanence}.
Moreover, it suffices to assume that $f$ is surjective, flat and
locally of finite presentation, see
Descent, Lemma \ref{descent-lemma-smooth-permanence}.}.
\end{enumerate}
Then $q$ is \'etale.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-smooth-permanence} we see that $q$ is smooth.
Thus we only need to see that $q$ has relative dimension $0$.
This follows from Lemma \ref{lemma-dimension-fibre-at-a-point-additive}
and the fact that $f$ and $p$ have relative dimension $0$.
\end{proof}

\noindent
A final characterization of smooth morphisms is that a smooth morphism
$f : X \to S$ is locally the composition of an \'etale morphism by a projection
$\mathbf{A}_S^d \to S$.

\begin{lemma}
\label{lemma-smooth-etale-over-affine-space}
\begin{slogan}
Smooth schemes are \'etale-locally like affine spaces.
\end{slogan}
Let $\varphi : X \to Y$ be a morphism of schemes. Let $x \in X$.
Let $V \subset Y$ be an affine open neighbourhood of $\varphi(x)$.
If $\varphi$ is smooth at $x$, then there exists an integer $d \geq 0$
and an affine open $U \subset X$ with $x \in U$ and
$\varphi(U) \subset V$ such that there exists a commutative diagram
$$
\xymatrix{
X \ar[d] & U \ar[l] \ar[d] \ar[r]_-\pi & \mathbf{A}^d_V \ar[ld] \\
Y & V \ar[l]
}
$$
where $\pi$ is \'etale.
\end{lemma}

\begin{proof}
By
Lemma \ref{lemma-smooth-locally-standard-smooth}
we can find an affine open $U$ as in the lemma such that
$\varphi|_U : U \to V$ is standard smooth. Write
$U = \Spec(A)$ and $V = \Spec(R)$ so that we can write
$$
A = R[x_1, \ldots, x_n]/(f_1, \ldots, f_c)
$$
with
$$
g =
\det
\left(
\begin{matrix}
\partial f_1/\partial x_1 &
\partial f_2/\partial x_1 &
\ldots &
\partial f_c/\partial x_1 \\
\partial f_1/\partial x_2 &
\partial f_2/\partial x_2 &
\ldots &
\partial f_c/\partial x_2 \\
\ldots & \ldots & \ldots & \ldots \\
\partial f_1/\partial x_c &
\partial f_2/\partial x_c &
\ldots &
\partial f_c/\partial x_c
\end{matrix}
\right)
$$
mapping to an invertible element of $A$. Then it is clear that
$R[x_{c + 1}, \ldots, x_n] \to A$ is standard smooth of relative
dimension $0$. Hence it is smooth of relative dimension $0$.
In other words the ring map $R[x_{c + 1}, \ldots, x_n] \to A$
is \'etale. As $\mathbf{A}^{n - c}_V = \Spec(R[x_{c + 1}, \ldots, x_n])$
the lemma with $d = n - c$.
\end{proof}
















\section{Relatively ample sheaves}
\label{section-relatively-ample}

\noindent
Let $X$ be a scheme and $\mathcal{L}$ an invertible sheaf on $X$.
Then $\mathcal{L}$ is ample on $X$ if $X$ is quasi-compact and
every point of $X$ is contained in an affine open of the form
$X_s$, where $s \in \Gamma(X, \mathcal{L}^{\otimes n})$ and $n \geq 1$, see
Properties, Definition \ref{properties-definition-ample}.
We turn this into a relative notion as follows.

\begin{definition}
\label{definition-relatively-ample}
\begin{reference}
\cite[II Definition 4.6.1]{EGA}
\end{reference}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{L}$ be an invertible $\mathcal{O}_X$-module.
We say $\mathcal{L}$ is {\it relatively ample}, or {\it $f$-relatively ample},
or {\it ample on $X/S$}, or {\it $f$-ample} if $f : X \to S$
is quasi-compact, and if for every affine open $V \subset S$
the restriction of $\mathcal{L}$ to the open subscheme
$f^{-1}(V)$ of $X$ is ample.
\end{definition}

\noindent
We note that the existence of a relatively ample sheaf on $X$ does not
force the morphism $X \to S$ to be of finite type.

\begin{lemma}
\label{lemma-ample-power-ample}
Let $X \to S$ be a morphism of schemes.
Let $\mathcal{L}$ be an invertible $\mathcal{O}_X$-module.
Let $n \geq 1$. Then $\mathcal{L}$ is $f$-ample if and only if
$\mathcal{L}^{\otimes n}$ is $f$-ample.
\end{lemma}

\begin{proof}
This follows from Properties, Lemma \ref{properties-lemma-ample-power-ample}.
\end{proof}

\begin{lemma}
\label{lemma-relatively-ample-separated}
Let $f : X \to S$ be a morphism of schemes.
If there exists an $f$-ample invertible sheaf, then
$f$ is separated.
\end{lemma}

\begin{proof}
Being separated is local on the base (see
Schemes, Lemma \ref{schemes-lemma-characterize-separated} for example;
it also follows easily from the definition).
Hence we may assume $S$ is affine and $X$
has an ample invertible sheaf. In this case the
result follows from
Properties, Lemma \ref{properties-lemma-ample-separated}.
\end{proof}

\noindent
There are many ways to characterize relatively ample invertible
sheaves, analogous to the equivalent conditions in
Properties, Proposition \ref{properties-proposition-characterize-ample}.
We will add these here as needed.

\begin{lemma}
\label{lemma-characterize-relatively-ample}
\begin{reference}
\cite[II, Proposition 4.6.3]{EGA}
\end{reference}
Let $f : X \to S$ be a quasi-compact morphism of schemes.
Let $\mathcal{L}$ be an invertible sheaf on $X$.
The following are equivalent:
\begin{enumerate}
\item The invertible sheaf $\mathcal{L}$ is $f$-ample.
\item There exists an open covering $S = \bigcup V_i$
such that each $\mathcal{L}|_{f^{-1}(V_i)}$ is ample
relative to $f^{-1}(V_i) \to V_i$.
\item There exists an affine open covering $S = \bigcup V_i$
such that each $\mathcal{L}|_{f^{-1}(V_i)}$ is ample.
\item There exists a quasi-coherent graded $\mathcal{O}_S$-algebra
$\mathcal{A}$ and a map of graded $\mathcal{O}_X$-algebras
$\psi : f^*\mathcal{A} \to \bigoplus_{d \geq 0} \mathcal{L}^{\otimes d}$
such that $U(\psi) = X$ and
$$
r_{\mathcal{L}, \psi} :
X
\longrightarrow
\underline{\text{Proj}}_S(\mathcal{A})
$$
is an open immersion (see Constructions, Lemma
\ref{constructions-lemma-invertible-map-into-relative-proj} for notation).
\item The morphism $f$ is quasi-separated and
part (4) above holds with
$\mathcal{A} = f_*(\bigoplus_{d \geq 0} \mathcal{L}^{\otimes d})$
and $\psi$ the adjunction mapping.
\item Same as (4) but just requiring $r_{\mathcal{L}, \psi}$
to be an immersion.
\end{enumerate}
\end{lemma}

\begin{proof}
It is immediate from the definition that (1) implies (2) and
(2) implies (3). It is clear that (5) implies (4).

\medskip\noindent
Assume (3) holds for the affine open covering $S = \bigcup V_i$.
We are going to show (5) holds.
Since each $f^{-1}(V_i)$ has an ample invertible sheaf we see
that $f^{-1}(V_i)$ is separated
(Properties, Lemma \ref{properties-lemma-ample-separated}).
Hence $f$ is separated. By
Schemes, Lemma \ref{schemes-lemma-push-forward-quasi-coherent}
we see that $\mathcal{A} = f_*(\bigoplus_{d \geq 0} \mathcal{L}^{\otimes d})$
is a quasi-coherent graded $\mathcal{O}_S$-algebra.
Denote $\psi : f^*\mathcal{A} \to \bigoplus_{d \geq 0} \mathcal{L}^{\otimes d}$
the adjunction mapping.
The description of the open $U(\psi)$ in
Constructions, Section
\ref{constructions-section-invertible-relative-proj}
and the definition of ampleness
of $\mathcal{L}|_{f^{-1}(V_i)}$ show that $U(\psi) = X$.
Moreover, Constructions,
Lemma \ref{constructions-lemma-invertible-map-into-relative-proj} part (3)
shows that the restriction of $r_{\mathcal{L}, \psi}$ to
$f^{-1}(V_i)$ is the same as the morphism from
Properties, Lemma \ref{properties-lemma-map-into-proj}
which is an open immersion according to
Properties, Lemma \ref{properties-lemma-ample-immersion-into-proj}.
Hence (5) holds.

\medskip\noindent
Let us show that (4) implies (1). Assume (4).
Denote $\pi : \underline{\text{Proj}}_S(\mathcal{A}) \to S$
the structure morphism. Choose $V \subset S$ affine open. By
Constructions, Definition \ref{constructions-definition-relative-proj}
we see that $\pi^{-1}(V) \subset \underline{\text{Proj}}_S(\mathcal{A})$
is equal to $\text{Proj}(A)$ where $A = \mathcal{A}(V)$
as a graded ring. Hence $r_{\mathcal{L}, \psi}$ maps
$f^{-1}(V)$ isomorphically onto
a quasi-compact open of $\text{Proj}(A)$.
Moreover, $\mathcal{L}^{\otimes d}$ is isomorphic to the pullback of
$\mathcal{O}_{\text{Proj}(A)}(d)$ for some $d \geq 1$.
(See part (3) of Constructions,
Lemma \ref{constructions-lemma-invertible-map-into-relative-proj}
and the final statement of Constructions,
Lemma \ref{constructions-lemma-invertible-map-into-proj}.)
This implies that $\mathcal{L}|_{f^{-1}(V)}$ is ample by
Properties, Lemmas \ref{properties-lemma-open-in-proj-ample}
and \ref{properties-lemma-ample-power-ample}.

\medskip\noindent
Assume (6). By the equivalence of (1) - (5) above we see that the
property of being relatively ample on $X/S$ is local on $S$. Hence
we may assume that $S$ is affine, and we have to show that
$\mathcal{L}$ is ample on $X$. In this case the morphism
$r_{\mathcal{L}, \psi}$ is identified with the morphism, also denoted
$r_{\mathcal{L}, \psi} : X \to \text{Proj}(A)$ associated to the map
$\psi : A = \mathcal{A}(V) \to \Gamma_*(X, \mathcal{L})$.
(See references above.) As above we also see that
$\mathcal{L}^{\otimes d}$ is the pullback of the sheaf
$\mathcal{O}_{\text{Proj}(A)}(d)$ for some $d \geq 1$.
Moreover, since $X$ is quasi-compact we
see that $X$ gets identified with a closed subscheme of a
quasi-compact open subscheme $Y \subset \text{Proj}(A)$.
By
Constructions, Lemma
\ref{constructions-lemma-ample-on-proj}
(see also
Properties, Lemma
\ref{properties-lemma-open-in-proj-ample})
we see that $\mathcal{O}_Y(d')$ is an ample invertible sheaf on
$Y$ for some $d' \geq 1$. Since the restriction of an ample
sheaf to a closed subscheme is ample, see
Properties, Lemma
\ref{properties-lemma-ample-on-closed}
we conclude that the pullback of
$\mathcal{O}_Y(d')$ is ample. Combining these results with
Properties, Lemma
\ref{properties-lemma-ample-power-ample}
we conclude that $\mathcal{L}$ is ample as desired.
\end{proof}

\begin{lemma}
\label{lemma-ample-over-affine}
\begin{reference}
\cite[II Corollary 4.6.6]{EGA}
\end{reference}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{L}$ be an invertible $\mathcal{O}_X$-module.
Assume $S$ affine.
Then $\mathcal{L}$ is $f$-relatively ample if and only
if $\mathcal{L}$ is ample on $X$.
\end{lemma}

\begin{proof}
Immediate from Lemma \ref{lemma-characterize-relatively-ample}
and the definitions.
\end{proof}

\begin{lemma}
\label{lemma-quasi-affine-O-ample}
\begin{reference}
\cite[II Proposition 5.1.6]{EGA}
\end{reference}
Let $f : X \to S$ be a morphism of schemes. Then $f$ is quasi-affine
if and only if $\mathcal{O}_X$ is $f$-relatively ample.
\end{lemma}

\begin{proof}
Follows from Properties, Lemma \ref{properties-lemma-quasi-affine-O-ample}
and the definitions.
\end{proof}

\begin{lemma}
\label{lemma-pullback-ample-tensor-relatively-ample}
Let $f : X \to Y$ be a morphism of schemes, $\mathcal{M}$
an invertible $\mathcal{O}_Y$-module, and $\mathcal{L}$ an
invertible $\mathcal{O}_X$-module.
\begin{enumerate}
\item If $\mathcal{L}$ is $f$-ample and $\mathcal{M}$
is ample, then $\mathcal{L} \otimes f^*\mathcal{M}^{\otimes a}$ is ample
for $a \gg 0$.
\item If $\mathcal{M}$ is ample
and $f$ quasi-affine, then $f^*\mathcal{M}$ is ample.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume $\mathcal{L}$ is $f$-ample and $\mathcal{M}$ ample.
By assumption $Y$ and $f$ are quasi-compact (see
Definition \ref{definition-relatively-ample} and
Properties, Definition \ref{properties-definition-ample}).
Hence $X$ is quasi-compact. By Properties, Lemma
\ref{properties-lemma-ample-separated} the scheme $Y$ is
separated and by Lemma \ref{lemma-relatively-ample-separated}
the morphism $f$ is separated. Hence $X$ is separated by
Schemes, Lemma \ref{schemes-lemma-separated-permanence}.
Pick $x \in X$. We can choose $m \geq 1$
and $t \in \Gamma(Y, \mathcal{M}^{\otimes m})$ such that $Y_t$
is affine and $f(x) \in Y_t$. Since $\mathcal{L}$ restricts to an
ample invertible sheaf on $f^{-1}(Y_t) = X_{f^*t}$
we can choose $n \geq 1$ and $s \in \Gamma(X_{f^*t}, \mathcal{L}^{\otimes n})$
with $x \in (X_{f^*t})_s$ with $(X_{f^*t})_s$ affine.
By Properties, Lemma \ref{properties-lemma-invert-s-sections} part (2)
whose assumptions are satisfied by the above,
there exists an integer $e \geq 1$ and a section
$s' \in \Gamma(X, \mathcal{L}^{\otimes n} \otimes f^*\mathcal{M}^{\otimes em})$
which restricts to $s(f^*t)^e$ on $X_{f^*t}$. For any $b > 0$
consider the section $s'' = s'(f^*t)^b$ of
$\mathcal{L}^{\otimes n} \otimes f^*\mathcal{M}^{\otimes (e + b)m}$.
Then $X_{s''} = (X_{f^*t})_s$ is an affine open of $X$ containing $x$.
Picking $b$ such that $n$ divides $e + b$ we see
$\mathcal{L}^{\otimes n} \otimes f^*\mathcal{M}^{\otimes (e + b)m}$
is the $n$th power of $\mathcal{L} \otimes f^*\mathcal{M}^{\otimes a}$
for some $a$ and we can get any $a$ divisible by $m$ and big enough.
Since $X$ is quasi-compact a finite number of these affine opens
cover $X$. We conclude that for some $a$ sufficiently divisible and
large enough the invertible sheaf
$\mathcal{L} \otimes f^*\mathcal{M}^{\otimes a}$ is ample on $X$.
On the other hand, we know that $\mathcal{M}^{\otimes c}$
(and hence its pullback to $X$) is globally generated for all $c \gg 0$
by Properties, Proposition \ref{properties-proposition-characterize-ample}.
Thus $\mathcal{L} \otimes f^*\mathcal{M}^{\otimes a + c}$ is ample
(Properties, Lemma \ref{properties-lemma-ample-tensor-globally-generated})
for $c \gg 0$ and (1) is proved.

\medskip\noindent
Part (2) follows from Lemma \ref{lemma-quasi-affine-O-ample},
Properties, Lemma \ref{properties-lemma-ample-power-ample}, and
part (1).
\end{proof}

\begin{lemma}
\label{lemma-ample-composition}
Let $g : Y \to S$ and $f : X \to Y$ be morphisms of schemes.
Let $\mathcal{M}$ be an invertible $\mathcal{O}_Y$-module.
Let $\mathcal{L}$ be an invertible $\mathcal{O}_X$-module.
If $S$ is quasi-compact, $\mathcal{M}$ is $g$-ample, and
$\mathcal{L}$ is $f$-ample, then
$\mathcal{L} \otimes f^*\mathcal{M}^{\otimes a}$
is $g \circ f$-ample for $a \gg 0$.
\end{lemma}

\begin{proof}
Let $S = \bigcup_{i = 1, \ldots, n} V_i$ be a finite affine open covering.
By Lemma \ref{lemma-characterize-relatively-ample}
it suffices to prove that 
$\mathcal{L} \otimes f^*\mathcal{M}^{\otimes a}$
is ample on $(g \circ f)^{-1}(V_i)$ for $i = 1, \ldots, n$.
Thus the lemma follows from
Lemma \ref{lemma-pullback-ample-tensor-relatively-ample}.
\end{proof}

\begin{lemma}
\label{lemma-ample-base-change}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{L}$ be an invertible $\mathcal{O}_X$-module.
Let $S' \to S$ be a morphism of schemes.
Let $f' : X' \to S'$ be the base change of $f$ and denote
$\mathcal{L}'$ the pullback of $\mathcal{L}$ to $X'$.
If $\mathcal{L}$ is $f$-ample, then $\mathcal{L}'$ is $f'$-ample.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-characterize-relatively-ample} it suffices
to find an affine open covering $S' = \bigcup U'_i$
such that $\mathcal{L}'$ restricts to an ample invertible
sheaf on $(f')^{-1}(U_i')$ for all $i$. We may choose $U'_i$
mapping into an affine open $U_i \subset S$. In this case the
morphism $(f')^{-1}(U'_i) \to f^{-1}(U_i)$ is affine as a base
change of the affine morphism $U'_i \to U_i$
(Lemma \ref{lemma-base-change-affine}). Thus
$\mathcal{L}'|_{(f')^{-1}(U'_i)}$ is ample by
Lemma \ref{lemma-pullback-ample-tensor-relatively-ample}.
\end{proof}

\begin{lemma}
\label{lemma-ample-permanence}
Let $g : Y \to S$ and $f : X \to Y$ be morphisms of schemes.
Let $\mathcal{L}$ be an invertible $\mathcal{O}_X$-module.
If $\mathcal{L}$ is $g \circ f$-ample and $f$ is
quasi-compact\footnote{This follows if $g$ is quasi-separated by
Schemes, Lemma \ref{schemes-lemma-quasi-compact-permanence}.}
then $\mathcal{L}$ is $f$-ample.
\end{lemma}

\begin{proof}
Assume $f$ is quasi-compact and $\mathcal{L}$ is $g \circ f$-ample.
Let $U \subset S$ be an affine open and let $V \subset Y$ be
an affine open with $g(V) \subset U$.
Then $\mathcal{L}|_{(g \circ f)^{-1}(U)}$ is ample on
$(g \circ f)^{-1}(U)$ by assumption.
Since $f^{-1}(V) \subset (g \circ f)^{-1}(U)$ we see that
$\mathcal{L}|_{f^{-1}(V)}$ is ample on $f^{-1}(V)$ by
Properties, Lemma \ref{properties-lemma-ample-on-locally-closed}.
Namely, $f^{-1}(V) \to (g \circ f)^{-1}(U)$ is a quasi-compact
open immersion by
Schemes, Lemma \ref{schemes-lemma-quasi-compact-permanence}
as $(g \circ f)^{-1}(U)$ is separated
(Properties, Lemma \ref{properties-lemma-ample-separated})
and $f^{-1}(V)$ is quasi-compact (as $f$ is quasi-compact).
Thus we conclude that $\mathcal{L}$ is $f$-ample by
Lemma \ref{lemma-characterize-relatively-ample}.
\end{proof}







\section{Very ample sheaves}
\label{section-very-ample}

\noindent
Recall that given a quasi-coherent sheaf $\mathcal{E}$ on a scheme
$S$ the {\it projective bundle} associated to $\mathcal{E}$ is the morphism
$\mathbf{P}(\mathcal{E}) \to S$, where
$\mathbf{P}(\mathcal{E}) = \underline{\text{Proj}}_S(\text{Sym}(\mathcal{E}))$,
see
Constructions, Definition \ref{constructions-definition-projective-bundle}.

\begin{definition}
\label{definition-very-ample}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{L}$ be an invertible $\mathcal{O}_X$-module.
We say $\mathcal{L}$ is {\it relatively very ample} or more
precisely {\it $f$-relatively very ample}, or
{\it very ample on $X/S$}, or {\it $f$-very ample} if
there exist a quasi-coherent $\mathcal{O}_S$-module
$\mathcal{E}$ and an immersion $i : X \to \mathbf{P}(\mathcal{E})$
over $S$ such that
$\mathcal{L} \cong i^*\mathcal{O}_{\mathbf{P}(\mathcal{E})}(1)$.
\end{definition}



\noindent
Since there is no assumption of quasi-compactness in this definition it is not
true in general that a relatively very ample invertible sheaf is a relatively
ample invertible sheaf.

\begin{lemma}
\label{lemma-ample-very-ample}
\begin{reference}
\cite[II, Proposition 4.6.2]{EGA}
\end{reference}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{L}$ be an invertible $\mathcal{O}_X$-module.
If $f$ is quasi-compact and $\mathcal{L}$ is a relatively
very ample invertible sheaf, then $\mathcal{L}$ is a relatively
ample invertible sheaf.
\end{lemma}

\begin{proof}
By definition there exists quasi-coherent $\mathcal{O}_S$-module
$\mathcal{E}$ and an immersion $i : X \to \mathbf{P}(\mathcal{E})$
over $S$ such that
$\mathcal{L} \cong i^*\mathcal{O}_{\mathbf{P}(\mathcal{E})}(1)$.
Set $\mathcal{A} = \text{Sym}(\mathcal{E})$, so
$\mathbf{P}(\mathcal{E}) = \underline{\text{Proj}}_S(\mathcal{A})$
by definition. The graded $\mathcal{O}_S$-algebra $\mathcal{A}$
comes equipped with a map
$$
\psi :
\mathcal{A} \to
\bigoplus\nolimits_{n \geq 0}
\pi_*\mathcal{O}_{\mathbf{P}(\mathcal{E})}(n) \to
\bigoplus\nolimits_{n \geq 0}
f_*\mathcal{L}^{\otimes n}
$$
where the second arrow uses the identification
$\mathcal{L} \cong i^*\mathcal{O}_{\mathbf{P}(\mathcal{E})}(1)$.
By adjointness of $f_*$ and $f^*$ we get a morphism
$\psi : f^*\mathcal{A} \to \bigoplus_{n \geq 0}\mathcal{L}^{\otimes n}$.
We omit the verification that the morphism $r_{\mathcal{L}, \psi}$
associated to this map is exactly the immersion $i$.
Hence the result follows from
part (6) of Lemma \ref{lemma-characterize-relatively-ample}.
\end{proof}

\noindent
To arrive at the correct converse of this lemma we ask
whether given a relatively ample
invertible sheaf $\mathcal{L}$ there exists an integer $n \geq 1$ such
that $\mathcal{L}^{\otimes n}$ is relatively very ample? In general this
is false. There are several things that prevent this from being true:
\begin{enumerate}
\item Even if $S$ is affine, it can happen that no finite integer
$n$ works because $X \to S$ is not of finite type, see
Example \ref{example-not-finite-type-proj}.
\item The base not being quasi-compact means the result can be
prevented from being true even with $f$ finite type. Namely, given
a field $k$ there exists a scheme $X_d$ of finite type over $k$ with
an ample invertible sheaf $\mathcal{O}_{X_d}(1)$ so that the smallest
tensor power of $\mathcal{O}_{X_d}(1)$ which is very ample is the $d$th
power. See Example \ref{example-not-bounded}.
Taking $f$ to be the disjoint union of the schemes $X_d$ mapping
to the disjoint union of copies of $\Spec(k)$ gives an example.
\end{enumerate}
To see our version of the converse take a look at
Lemma \ref{lemma-finite-type-ample-very-ample} below.
We will do some preliminary work before proving it.

\begin{example}
\label{example-very-ample}
Let $S$ be a scheme. Let $\mathcal{A}$ be a quasi-coherent graded
$\mathcal{O}_S$-algebra generated by $\mathcal{A}_1$ over $\mathcal{A}_0$.
Set $X = \underline{\text{Proj}}_S(\mathcal{A})$. In this case
$\mathcal{O}_X(1)$ is invertible and very ample on $X/S$. Namely,
the morphism associated to the graded $\mathcal{O}_S$-algebra map
$$
\text{Sym}_{\mathcal{O}_X}^*(\mathcal{A}_1)
\longrightarrow
\mathcal{A}
$$
is a closed immersion $X \to \mathbf{P}(\mathcal{A}_1)$ which pulls back
$\mathcal{O}_{\mathbf{P}(\mathcal{A}_1)}(1)$ to $\mathcal{O}_X(1)$, see
Constructions, Lemma
\ref{constructions-lemma-surjective-generated-degree-1-map-relative-proj}.
\end{example}

\begin{example}
\label{example-not-finite-type-proj}
Let $k$ be a field.
Consider the graded $k$-algebra
$$
A = k[U, V, Z_1, Z_2, Z_3, \ldots]/I
\quad
\text{with}
\quad
I = (U^2 - Z_1^2, U^4 - Z_2^2, U^6 - Z_3^2, \ldots)
$$
with grading given by $\deg(U) = \deg(V) = \deg(Z_1) = 1$
and $\deg(Z_d) = d$.
Note that $X = \text{Proj}(A)$ is covered by $D_{+}(U)$ and
$D_{+}(V)$. Hence the sheaves $\mathcal{O}_X(n)$ are all
invertible and isomorphic to $\mathcal{O}_X(1)^{\otimes n}$.
In particular $\mathcal{O}_X(1)$ is ample and $f$-ample
for the morphism $f : X \to \Spec(k)$.
We claim that no power of $\mathcal{O}_X(1)$ is $f$-relatively very ample.
Namely, it is easy to see that $\Gamma(X, \mathcal{O}_X(n))$
is the degree $n$ summand of the algebra $A$. Hence if $\mathcal{O}_X(n)$
were very ample, then $X$ would be a closed subscheme of a projective
space over $k$ and hence of finite type over $k$. On the other hand
$D_{+}(V)$ is the spectrum of
$k[t, t_1, t_2, \ldots]/(t^2 - t_1^2, t^4 - t_2^2, t^6 - t_3^2, \ldots)$
which is not of finite type over $k$.
\end{example}

\begin{example}
\label{example-not-bounded}
Let $k$ be an infinite field. Let $\lambda_1, \lambda_2, \lambda_3, \ldots$
be pairwise distinct elements of $k^*$. (This is not strictly necessary,
and in fact the example works perfectly well even if all $\lambda_i$
are equal to $1$.)
Consider the graded $k$-algebra
$$
A_d = k[U, V, Z]/I_d
\quad
\text{with}
\quad
I_d = (Z^2 - \prod\nolimits_{i = 1}^{2d} (U - \lambda_i V)).
$$
with grading given by $\deg(U) = \deg(V) = 1$ and $\deg(Z) = d$.
Then $X_d = \text{Proj}(A_d)$ has ample invertible sheaf
$\mathcal{O}_{X_d}(1)$. We claim that if $\mathcal{O}_{X_d}(n)$
is very ample, then $n \geq d$. The reason for this is that $Z$
has degree $d$, and hence $\Gamma(X_d, \mathcal{O}_{X_d}(n)) =
k[U, V]_n$ for $n < d$. Details omitted.
\end{example}

\begin{lemma}
\label{lemma-relatively-very-ample-separated}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{L}$ be an invertible sheaf on $X$.
If $\mathcal{L}$ is relatively very ample on $X/S$ then
$f$ is separated.
\end{lemma}

\begin{proof}
Being separated is local on the base (see
Schemes, Section \ref{schemes-section-separation-axioms}).
An immersion is separated
(see Schemes, Lemma \ref{schemes-lemma-immersions-monomorphisms}).
Hence the lemma follows since locally $X$ has an immersion into
the homogeneous spectrum of a graded ring which is separated, see
Constructions, Lemma \ref{constructions-lemma-proj-separated}.
\end{proof}

\begin{lemma}
\label{lemma-relatively-very-ample}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{L}$ be an invertible sheaf on $X$.
Assume $f$ is quasi-compact. The following are
equivalent
\begin{enumerate}
\item $\mathcal{L}$ is relatively very ample on $X/S$,
\item there exists an open covering $S = \bigcup V_j$ such
that $\mathcal{L}|_{f^{-1}(V_j)}$ is relatively very ample
on $f^{-1}(V_j)/V_j$ for all $j$,
\item there exists a quasi-coherent sheaf of graded
$\mathcal{O}_S$-algebras $\mathcal{A}$ generated in degree
$1$ over $\mathcal{O}_S$ and a map of graded $\mathcal{O}_X$-algebras
$\psi : f^*\mathcal{A} \to \bigoplus_{n \geq 0} \mathcal{L}^{\otimes n}$
such that $f^*\mathcal{A}_1 \to \mathcal{L}$ is surjective and the
associated morphism
$r_{\mathcal{L}, \psi} : X \to \underline{\text{Proj}}_S(\mathcal{A})$
is an immersion, and
\item $f$ is quasi-separated, the canonical map
$\psi : f^*f_*\mathcal{L} \to \mathcal{L}$ is surjective, and
the associated map $r_{\mathcal{L}, \psi} : X \to \mathbf{P}(f_*\mathcal{L})$
is an immersion.
\end{enumerate}
\end{lemma}

\begin{proof}
It is clear that (1) implies (2). It is also clear that
(4) implies (1); the hypothesis of quasi-separation
in (4) is used to guarantee that $f_*\mathcal{L}$ is quasi-coherent via
Schemes, Lemma \ref{schemes-lemma-push-forward-quasi-coherent}.

\medskip\noindent
Assume (2). We will prove (4).
Let $S = \bigcup V_j$ be an open covering as in (2).
Set $X_j = f^{-1}(V_j)$ and $f_j : X_j \to V_j$ the
restriction of $f$. We see that $f$ is separated by
Lemma \ref{lemma-relatively-very-ample-separated} (as being
separated is local on the base). By assumption there exists a
quasi-coherent $\mathcal{O}_{V_j}$-module $\mathcal{E}_j$ and an immersion
$i_j : X_j \to \mathbf{P}(\mathcal{E}_j)$ with
$\mathcal{L}|_{X_j} \cong i_j^*\mathcal{O}_{\mathbf{P}(\mathcal{E}_j)}(1)$.
The morphism $i_j$ corresponds to a surjection
$f_j^*\mathcal{E}_j \to \mathcal{L}|_{X_j}$, see
Constructions, Section \ref{constructions-section-projective-bundle}.
This map is adjoint to a map $\mathcal{E}_j \to f_*\mathcal{L}|_{V_j}$
such that the composition
$$
f_j^*\mathcal{E}_j \to (f^*f_*\mathcal{L})|_{X_j} \to \mathcal{L}|_{X_j}
$$
is surjective. We conclude that
$\psi : f^*f_*\mathcal{L} \to \mathcal{L}$ is surjective. Let
$r_{\mathcal{L}, \psi} : X \to \mathbf{P}(f_*\mathcal{L})$ be the
associated morphism. We still have to show that $r_{\mathcal{L}, \psi}$
is an immersion; we urge the reader to prove this for themselves.
The $\mathcal{O}_{V_j}$-module map $\mathcal{E}_j \to f_*\mathcal{L}|_{V_j}$
determines a homomorphism on symmetric algebras, which in turn defines a
morphism
$$
\mathbf{P}(f_*\mathcal{L}|_{V_j}) \supset U_j \longrightarrow
\mathbf{P}(\mathcal{E}_j)
$$
where $U_j$ is the open subscheme of
Constructions, Lemma \ref{constructions-lemma-morphism-relative-proj}.
The compatibility of $\psi$ with $\mathcal{E}_j \to f_*\mathcal{L}|_{V_j}$
shows that $r_{\mathcal{L}, \psi}(X_j) \subset U_j$ and that there is a
factorization
$$
\xymatrix{
X_j \ar[r]^-{r_{\mathcal{L}, \psi}} & U_j \ar[r] &
\mathbf{P}(\mathcal{E}_j)
}
$$
We omit the verification.
This shows that $r_{\mathcal{L}, \psi}$ is an immersion.

\medskip\noindent
At this point we see that (1), (2) and (4) are equivalent.
Clearly (4) implies (3). Assume (3). We will prove (1).
Let $\mathcal{A}$ be a quasi-coherent sheaf of graded $\mathcal{O}_S$-algebras
generated in degree $1$ over $\mathcal{O}_S$. Consider the map of
graded $\mathcal{O}_S$-algebras $\text{Sym}(\mathcal{A}_1) \to \mathcal{A}$.
This is surjective by hypothesis and hence induces a closed immersion
$$
\underline{\text{Proj}}_S(\mathcal{A})
\longrightarrow
\mathbf{P}(\mathcal{A}_1)
$$
which pulls back $\mathcal{O}(1)$ to $\mathcal{O}(1)$,
see Constructions, Lemma
\ref{constructions-lemma-surjective-generated-degree-1-map-relative-proj}.
Hence it is clear that (3) implies (1).
\end{proof}

\begin{lemma}
\label{lemma-very-ample-base-change}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{L}$ be an invertible $\mathcal{O}_X$-module.
Let $S' \to S$ be a morphism of schemes.
Let $f' : X' \to S'$ be the base change of $f$ and denote
$\mathcal{L}'$ the pullback of $\mathcal{L}$ to $X'$.
If $\mathcal{L}$ is $f$-very ample, then $\mathcal{L}'$ is $f'$-very ample.
\end{lemma}

\begin{proof}
By Definition \ref{definition-very-ample} there exists there exist a
quasi-coherent $\mathcal{O}_S$-module $\mathcal{E}$ and an immersion
$i : X \to \mathbf{P}(\mathcal{E})$ over $S$ such that
$\mathcal{L} \cong i^*\mathcal{O}_{\mathbf{P}(\mathcal{E})}(1)$.
The base change of $\mathbf{P}(\mathcal{E})$ to $S'$ is
the projective bundle associated to the pullback $\mathcal{E}'$
of $\mathcal{E}$ and the pullback of
$\mathcal{O}_{\mathbf{P}(\mathcal{E})}(1)$
is
$\mathcal{O}_{\mathbf{P}(\mathcal{E}')}(1)$, see
Constructions, Lemma \ref{constructions-lemma-relative-proj-base-change}.
Finally, the base change
of an immersion is an immersion
(Schemes, Lemma \ref{schemes-lemma-base-change-immersion}).
\end{proof}







\section{Ample and very ample sheaves relative to finite type morphisms}
\label{section-ample-finite-type}

\noindent
In fact most of the material in this section is about the notion of
a (quasi-)projective morphism which we have not defined yet.

\begin{lemma}
\label{lemma-very-ample-finite-type-over-affine}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{L}$ be an invertible sheaf on $X$.
Assume that
\begin{enumerate}
\item the invertible sheaf $\mathcal{L}$ is very ample on $X/S$,
\item the morphism $X \to S$ is of finite type, and
\item $S$ is affine.
\end{enumerate}
Then there exist an $n \geq 0$ and an immersion
$i : X \to \mathbf{P}^n_S$ over $S$ such that
$\mathcal{L} \cong i^*\mathcal{O}_{\mathbf{P}^n_S}(1)$.
\end{lemma}

\begin{proof}
Assume (1), (2) and (3).
Condition (3) means $S = \Spec(R)$ for some ring $R$.
Condition (1) means by definition
there exists a quasi-coherent $\mathcal{O}_S$-module
$\mathcal{E}$ and an immersion $\alpha : X \to \mathbf{P}(\mathcal{E})$
such that $\mathcal{L} = \alpha^*\mathcal{O}_{\mathbf{P}(\mathcal{E})}(1)$.
Write $\mathcal{E} = \widetilde{M}$ for some $R$-module $M$.
Thus we have
$$
\mathbf{P}(\mathcal{E}) = \text{Proj}(\text{Sym}_R(M)).
$$
Since $\alpha$ is an immersion, and since the topology of
$\text{Proj}(\text{Sym}_R(M))$ is generated by the standard
opens $D_{+}(f)$, $f \in \text{Sym}_R^d(M)$, $d \geq 1$,
we can find for each $x \in X$ an
$f \in \text{Sym}_R^d(M)$, $d \geq 1$, with $\alpha(x) \in D_{+}(f)$
such that
$$
\alpha|_{\alpha^{-1}(D_{+}(f))} : \alpha^{-1}(D_{+}(f)) \to D_{+}(f)
$$
is a closed immersion.
Condition (2) implies $X$ is quasi-compact. Hence we can find
a finite collection of elements
$f_j \in \text{Sym}_R^{d_j}(M)$, $d_j \geq 1$
such that for each $f = f_j$ the displayed map above
is a closed immersion and such that $\alpha(X) \subset \bigcup D_{+}(f_j)$.
Write $U_j = \alpha^{-1}(D_{+}(f_j))$. Note that $U_j$ is affine
as a closed subscheme of the affine scheme $D_{+}(f_j)$.
Write $U_j = \Spec(A_j)$. Condition (2) also implies that
$A_j$ is of finite type over $R$, see
Lemma \ref{lemma-locally-finite-type-characterize}.
Choose finitely many $x_{j, k} \in A_j$ which
generate $A_j$ as a $R$-algebra. Since $\alpha|_{U_j}$ is a closed
immersion we see that $x_{j, k}$ is the image of an element
$$
f_{j, k}/f_j^{e_{j, k}} \in \text{Sym}_R(M)_{(f_j)}
=
\Gamma(D_{+}(f_j), \mathcal{O}_{\text{Proj}(\text{Sym}_R(M))}).
$$
Finally, choose $n \geq 1$ and elements $y_0, \ldots, y_n \in M$ such that each
of the polynomials $f_j, f_{j, k} \in \text{Sym}_R(M)$ is a polynomial
in the elements $y_t$ with coefficients in $R$.
Consider the graded ring map
$$
\psi : R[Y_0, \ldots, Y_n] \longrightarrow \text{Sym}_R(M),
\quad Y_i \longmapsto y_i.
$$
Denote $F_j$, $F_{j, k}$ the elements of $R[Y_0, \ldots, Y_n]$ such
that $\psi(F_j) = f_j$ and $\psi(F_{j, k}) = f_{j, k}$.
By Constructions, Lemma \ref{constructions-lemma-morphism-proj}
we obtain an open subscheme
$$
U(\psi) \subset \text{Proj}(\text{Sym}_R(M))
$$
and a morphism
$r_\psi : U(\psi) \to \mathbf{P}^n_R$. This morphism
satisfies $r_\psi^{-1}(D_{+}(F_j)) = D_{+}(f_j)$, and hence we see
that $\alpha(X) \subset U(\psi)$. Moreover, it is clear
that
$$
i = r_\psi \circ \alpha : X \longrightarrow \mathbf{P}^n_R
$$
is still an immersion since
$i^\sharp(F_{j, k}/F_j^{e_{j, k}}) = x_{j, k} \in
A_j = \Gamma(U_j, \mathcal{O}_X)$
by construction. Moreover, the morphism $r_\psi$ comes
equipped with a map
$\theta : r_\psi^*\mathcal{O}_{\mathbf{P}^n_R}(1)
\to \mathcal{O}_{\text{Proj}(\text{Sym}_R(M))}(1)|_{U(\psi)}$
which is an isomorphism in this case (for construction $\theta$
see lemma cited above; some details omitted).
Since the original map $\alpha$ was assumed to have the
property that
$\mathcal{L} = \alpha^*\mathcal{O}_{\text{Proj}(\text{Sym}_R(M))}(1)$
we win.
\end{proof}

\begin{lemma}
\label{lemma-quasi-affine-finite-type-over-S}
Let $\pi : X \to S$ be a morphism of schemes.
Assume that $X$ is quasi-affine and that $\pi$ is locally of finite type.
Then there exist $n \geq 0$ and an immersion $i : X \to \mathbf{A}^n_S$
over $S$.
\end{lemma}

\begin{proof}
Let $A = \Gamma(X, \mathcal{O}_X)$. By assumption $X$ is quasi-compact
and is identified with an open subscheme of $\Spec(A)$, see
Properties, Lemma \ref{properties-lemma-quasi-affine}.
Moreover, the set of opens $X_f$, for those $f \in A$ such that $X_f$ is
affine, forms a basis for the topology of $X$, see the proof of
Properties, Lemma \ref{properties-lemma-quasi-affine}.
Hence we can find a finite number of $f_j \in A$, $j = 1, \ldots, m$ such that
$X = \bigcup X_{f_j}$, and such that $\pi(X_{f_j}) \subset V_j$ for
some affine open $V_j \subset S$. By
Lemma \ref{lemma-locally-finite-type-characterize}
the ring maps $\mathcal{O}(V_j) \to \mathcal{O}(X_{f_j}) = A_{f_j}$
are of finite type. Thus we may choose $a_1, \ldots, a_N \in A$ such that
the elements $a_1, \ldots, a_N, 1/f_j$ generate
$A_{f_j}$ over $\mathcal{O}(V_j)$ for each $j$. Take $n = m + N$ and
let
$$
i : X \longrightarrow \mathbf{A}^n_S
$$
be the morphism given by the global sections
$f_1, \ldots, f_m, a_1, \ldots, a_N$ of the structure sheaf of $X$.
Let $D(x_j) \subset \mathbf{A}^n_S$ be the open subscheme where the
$j$th coordinate function is nonzero.
Then for $1 \leq j \leq m$ we have $i^{-1}(D(x_j)) = X_{f_j}$ and
the induced morphism $X_{f_j} \to D(x_j)$ factors through the affine
open $\Spec(\mathcal{O}(V_j)[x_1, \ldots, x_n, 1/x_j])$
of $D(x_j)$. Since the ring map
$\mathcal{O}(V_j)[x_1, \ldots, x_n, 1/x_j] \to A_{f_j}$ is
surjective by construction we conclude that $i^{-1}(D(x_j)) \to D(x_j)$
is an immersion as desired.
\end{proof}

\begin{lemma}
\label{lemma-quasi-projective-finite-type-over-S}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{L}$ be an invertible sheaf on $X$.
Assume that
\begin{enumerate}
\item the invertible sheaf $\mathcal{L}$ is ample on $X$, and
\item the morphism $X \to S$ is locally of finite type.
\end{enumerate}
Then there exists a $d_0 \geq 1$ such that for every $d \geq d_0$
there exist an $n \geq 0$ and an immersion
$i : X \to \mathbf{P}^n_S$ over $S$ such that
$\mathcal{L}^{\otimes d} \cong i^*\mathcal{O}_{\mathbf{P}^n_S}(1)$.
\end{lemma}

\begin{proof}
Let
$A = \Gamma_*(X, \mathcal{L}) =
\bigoplus_{d \geq 0} \Gamma(X, \mathcal{L}^{\otimes d})$.
By Properties, Proposition \ref{properties-proposition-characterize-ample}
the set of affine opens $X_a$ with $a \in A_{+}$ homogeneous forms
a basis for the topology of $X$. Hence we can find finitely
many such elements $a_0, \ldots, a_n \in A_{+}$ such that
\begin{enumerate}
\item we have $X = \bigcup_{i = 0, \ldots, n} X_{a_i}$,
\item each $X_{a_i}$ is affine, and
\item each $X_{a_i}$ maps into an affine open $V_i \subset S$.
\end{enumerate}
By Lemma \ref{lemma-locally-finite-type-characterize}
we see that the ring maps
$\mathcal{O}_S(V_i) \to \mathcal{O}_X(X_{a_i})$ are
of finite type. Hence we can find finitely many
elements $f_{ij} \in \mathcal{O}_X(X_{a_i})$, $j = 1, \ldots, n_i$
which generate $\mathcal{O}_X(X_{a_i})$ as an $\mathcal{O}_S(V_i)$-algebra.
By Properties, Lemma \ref{properties-lemma-invert-s-sections}
we may write each
$f_{ij}$ as $a_{ij}/a_i^{e_{ij}}$ for some
$a_{ij} \in A_{+}$ homogeneous. Let $N$ be a positive integer which
is a common multiple of all the degrees of the elements
$a_i$, $a_{ij}$. Consider the elements
$$
a_i^{N/\deg(a_i)}, \ a_{ij}a_i^{(N/\deg(a_i)) - e_{ij}} \in A_N.
$$
By construction these generate the invertible sheaf
$\mathcal{L}^{\otimes N}$ over $X$. Hence they give rise
to a morphism
$$
j : X \longrightarrow
\mathbf{P}_S^{m}
\quad
\text{with } m = n + \sum n_i
$$
over $S$, see Constructions, Lemma \ref{constructions-lemma-projective-space}
and Definition \ref{constructions-definition-projective-space}.
Moreover, $j^*\mathcal{O}_{\mathbf{P}_S}(1) = \mathcal{L}^{\otimes N}$.
We name the homogeneous coordinates $T_0, \ldots, T_n, T_{ij}$
instead of $T_0, \ldots, T_m$.
For $i = 0, \ldots, n$ we have $j^{-1}(D_{+}(T_i)) = X_{a_i}$.
Moreover, pulling back the element $T_{ij}/T_i$ via $j^\sharp$ we
get the element $f_{ij} \in \mathcal{O}_X(X_{a_i})$.
Hence the morphism $j$ restricted to $X_{a_i}$
gives a closed immersion of $X_{a_i}$ into the affine open
$D_{+}(T_i) \cap \mathbf{P}^m_{V_i}$ of $\mathbf{P}^N_S$.
Hence we conclude that the morphism $j$ is an immersion.
This implies the lemma holds for some $d$ and $n$ which is enough
in virtually all applications.

\medskip\noindent
This proves that for one $d_2 \geq 1$
(namely $d_2 = N$ above), some $m \geq 0$ there exists some
immersion $j : X \to \mathbf{P}^m_S$ given by global sections
$s'_0, \ldots, s'_m \in \Gamma(X, \mathcal{L}^{\otimes d_2})$.
By Properties, Proposition \ref{properties-proposition-characterize-ample}
we know there exists an integer
$d_1$ such that $\mathcal{L}^{\otimes d}$ is globally generated
for all $d \geq d_1$. Set $d_0 = d_1 + d_2$. We claim that
the lemma holds with this value of $d_0$. Namely, given
an integer $d \geq d_0$ we may choose $s''_1, \ldots, s''_t
\in \Gamma(X, \mathcal{L}^{\otimes d - d_2})$ which generate
$\mathcal{L}^{\otimes d - d_2}$ over $X$. Set $k = (m + 1)t$ and
denote $s_0, \ldots, s_k$ the collection of sections
$s'_\alpha s''_\beta$, $\alpha = 0, \ldots, m$,
$\beta = 1, \ldots, t$. These generate $\mathcal{L}^{\otimes d}$
over $X$ and therefore define a morphism
$$
i : X \longrightarrow \mathbf{P}^{k - 1}_S
$$
such that $i^*\mathcal{O}_{\mathbf{P}^n_S}(1) \cong \mathcal{L}^{\otimes d}$.
To see that $i$ is an immersion, observe that $i$ is the composition
$$
X \longrightarrow \mathbf{P}^m_S \times_S \mathbf{P}^{t - 1}_S
\longrightarrow \mathbf{P}^{k - 1}_S
$$
where the first morphism is $(j, j')$ with $j'$ given by
$s''_1, \ldots, s''_t$ and the
second morphism is the Segre embedding
(Constructions, Lemma \ref{constructions-lemma-segre-embedding}).
Since $j$ is an immersion, so is $(j, j')$
(apply Lemma \ref{lemma-immersion-permanence}
to $X \to \mathbf{P}^m_S \times_S \mathbf{P}^{t - 1}_S
\to \mathbf{P}^m_S$). Thus $i$ is a composition of
immersions and hence an immersion
(Schemes, Lemma \ref{schemes-lemma-composition-immersion}).
\end{proof}

\begin{lemma}
\label{lemma-finite-type-over-affine-ample-very-ample}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{L}$ be an invertible $\mathcal{O}_X$-module.
Assume $S$ affine and $f$ of finite type.
The following are equivalent
\begin{enumerate}
\item $\mathcal{L}$ is ample on $X$,
\item $\mathcal{L}$ is $f$-ample,
\item $\mathcal{L}^{\otimes d}$ is $f$-very ample for some $d \geq 1$,
\item $\mathcal{L}^{\otimes d}$ is $f$-very ample for all $d \gg 1$,
\item for some $d \geq 1$ there exist $n \geq 1$ and an immersion
$i : X \to \mathbf{P}^n_S$ such that
$\mathcal{L}^{\otimes d} \cong i^*\mathcal{O}_{\mathbf{P}^n_S}(1)$, and
\item for all $d \gg 1$ there exist $n \geq 1$ and an immersion
$i : X \to \mathbf{P}^n_S$ such that
$\mathcal{L}^{\otimes d} \cong i^*\mathcal{O}_{\mathbf{P}^n_S}(1)$.
\end{enumerate}
\end{lemma}

\begin{proof}
The equivalence of (1) and (2) is Lemma \ref{lemma-ample-over-affine}.
The implication (2) $\Rightarrow$ (6) is
Lemma \ref{lemma-quasi-projective-finite-type-over-S}.
Trivially (6) implies (5).
As $\mathbf{P}^n_S$ is a projective bundle over $S$ (see
Constructions, Lemma \ref{constructions-lemma-projective-space-bundle})
we see that
(5) implies (3) and (6) implies (4) from the definition of a
relatively very ample sheaf.
Trivially (4) implies (3). To finish we have to show that
(3) implies (2) which follows from Lemma \ref{lemma-ample-very-ample}
and Lemma \ref{lemma-ample-power-ample}.
\end{proof}

\begin{lemma}
\label{lemma-finite-type-ample-very-ample}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{L}$ be an invertible $\mathcal{O}_X$-module.
Assume $S$ quasi-compact and $f$ of finite type.
The following are equivalent
\begin{enumerate}
\item $\mathcal{L}$ is $f$-ample,
\item $\mathcal{L}^{\otimes d}$ is $f$-very ample for some $d \geq 1$,
\item $\mathcal{L}^{\otimes d}$ is $f$-very ample for all $d \gg 1$.
\end{enumerate}
\end{lemma}

\begin{proof}
Trivially (3) implies (2). Lemma \ref{lemma-ample-very-ample} guarantees that
(2) implies (1) since a morphism of finite type is quasi-compact
by definition. Assume that $\mathcal{L}$ is $f$-ample. Choose a finite affine
open covering $S = V_1 \cup \ldots \cup V_m$. Write $X_i = f^{-1}(V_i)$.
By Lemma \ref{lemma-finite-type-over-affine-ample-very-ample} above we see
there exists a $d_0$ such that $\mathcal{L}^{\otimes d}$ is
relatively very ample on $X_i/V_i$ for all $d \geq d_0$. Hence we conclude
(1) implies (3) by Lemma \ref{lemma-relatively-very-ample}.
\end{proof}

\noindent
The following two lemmas provide the most used and most useful
characterizations of relatively very ample and relatively ample
invertible sheaves when the morphism is of finite type.

\begin{lemma}
\label{lemma-characterize-very-ample-on-finite-type}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{L}$ be an invertible sheaf on $X$.
Assume $f$ is of finite type.
The following are equivalent:
\begin{enumerate}
\item $\mathcal{L}$ is $f$-relatively very ample, and
\item there exist an open covering $S = \bigcup V_j$,
for each $j$ an integer $n_j$, and immersions
$$
i_j :
X_j = f^{-1}(V_j) = V_j \times_S X
\longrightarrow
\mathbf{P}^{n_j}_{V_j}
$$
over $V_j$ such that
$\mathcal{L}|_{X_j} \cong i_j^*\mathcal{O}_{\mathbf{P}^{n_j}_{V_j}}(1)$.
\end{enumerate}
\end{lemma}

\begin{proof}
We see that (1) implies (2) by taking an affine open covering of $S$
and applying Lemma \ref{lemma-very-ample-finite-type-over-affine} to
each of the restrictions of $f$ and
$\mathcal{L}$. We see that (2) implies (1) by
Lemma \ref{lemma-relatively-very-ample}.
\end{proof}

\begin{lemma}
\label{lemma-characterize-ample-on-finite-type}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{L}$ be an invertible sheaf on $X$.
Assume $f$ is of finite type.
The following are equivalent:
\begin{enumerate}
\item $\mathcal{L}$ is $f$-relatively ample, and
\item there exist an open covering $S = \bigcup V_j$,
for each $j$ an integers $d_j \geq 1$,
$n_j \geq 0$, and immersions
$$
i_j :
X_j = f^{-1}(V_j) = V_j \times_S X
\longrightarrow
\mathbf{P}^{n_j}_{V_j}
$$
over $V_j$ such that
$\mathcal{L}^{\otimes d_j}|_{X_j} \cong
i_j^*\mathcal{O}_{\mathbf{P}^{n_j}_{V_j}}(1)$.
\end{enumerate}
\end{lemma}

\begin{proof}
We see that (1) implies (2) by taking an affine open covering of $S$
and applying Lemma \ref{lemma-finite-type-over-affine-ample-very-ample} to
each of the restrictions of $f$ and
$\mathcal{L}$. We see that (2) implies (1) by
Lemma \ref{lemma-characterize-relatively-ample}.
\end{proof}

\begin{lemma}
\label{lemma-invertible-add-enough-ample-very-ample}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{N}$, $\mathcal{L}$ be invertible $\mathcal{O}_X$-modules.
Assume $S$ is quasi-compact, $f$ is of finite type, and $\mathcal{L}$
is $f$-ample. Then
$\mathcal{N} \otimes_{\mathcal{O}_X} \mathcal{L}^{\otimes d}$
is $f$-very ample for all $d \gg 1$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-characterize-very-ample-on-finite-type}
we reduce to the case $S$ is affine. Combining
Lemma \ref{lemma-finite-type-over-affine-ample-very-ample} and
Properties, Proposition \ref{properties-proposition-characterize-ample}
we can find an integer $d_0$ such that
$\mathcal{N} \otimes \mathcal{L}^{\otimes d_0}$
is globally generated. Choose global sections
$s_0, \ldots, s_n$ of $\mathcal{N} \otimes \mathcal{L}^{\otimes d_0}$
which generate it. This determines a morphism
$j : X \to \mathbf{P}^n_S$ over $S$. By
Lemma \ref{lemma-finite-type-over-affine-ample-very-ample}
we can also pick an integer $d_1$ such that for all $d \geq d_1$
there exist sections $t_{d, 0}, \ldots, t_{d, n(d)}$
of $\mathcal{L}^{\otimes d}$ which generate it and define
an immersion
$$
j_d = \varphi_{\mathcal{L}^{\otimes d}, t_{d, 0}, \ldots, t_{d, n(d)}} :
X
\longrightarrow
\mathbf{P}^{n(d)}_S
$$
over $S$. Then for $d \geq d_0 + d_1$ we can consider the
morphism
$$
\varphi_{\mathcal{N} \otimes \mathcal{L}^{\otimes d},
s_j \otimes t_{d - d_0, i}} :
X
\longrightarrow
\mathbf{P}^{(n + 1)(n(d - d_0) + 1) - 1}_S
$$
This morphism is an immersion as it is the composition
$$
X \to \mathbf{P}^n_S \times_S \mathbf{P}^{n(d - d_0)}_S
\to \mathbf{P}^{(n + 1)(n(d - d_0) + 1) - 1}_S
$$
where the first morphism is $(j, j_{d - d_0})$ and
the second is the Segre embedding
(Constructions, Lemma \ref{constructions-lemma-segre-embedding}).
Since $j$ is an immersion, so is $(j, j_{d - d_0})$
(apply Lemma \ref{lemma-immersion-permanence}). We have a composition of
immersions and hence an immersion
(Schemes, Lemma \ref{schemes-lemma-composition-immersion}).
\end{proof}










\section{Quasi-projective morphisms}
\label{section-quasi-projective}

\noindent
The discussion in the previous section suggests the following definitions.
We take our definition of quasi-projective from \cite{EGA}. The version
with the letter ``H'' is the definition in \cite{H}.

\begin{definition}
\label{definition-quasi-projective}
\begin{reference}
\cite[II, Definition 5.3.1]{EGA} and \cite[page 103]{H}
\end{reference}
Let $f : X \to S$ be a morphism of schemes.
\begin{enumerate}
\item We say $f$ is {\it quasi-projective} if $f$ is of finite type
and there exists an $f$-relatively ample invertible $\mathcal{O}_X$-module.
\item We say $f$ is {\it H-quasi-projective} if there exists
a quasi-compact immersion $X \to \mathbf{P}^n_S$ over $S$ for some
$n$.\footnote{This is not exactly the same as the definition in Hartshorne.
Namely, the definition in Hartshorne (8th corrected printing, 1997) is that
$f$ should be the composition of an open immersion followed by a H-projective
morphism (see Definition \ref{definition-projective}), which does not imply
$f$ is quasi-compact. See
Lemma \ref{lemma-H-quasi-projective-open-H-projective} for
the implication in the other direction.}
\item We say $f$ is {\it locally quasi-projective} if there exists
an open covering $S = \bigcup V_j$ such that each $f^{-1}(V_j) \to V_j$
is quasi-projective.
\end{enumerate}
\end{definition}

\noindent
As this definition suggests the property of being quasi-projective
is not local on $S$. At a later stage we will be able to say more
about the category of quasi-projective schemes, see
More on Morphisms, Section \ref{more-morphisms-section-quasi-projective}.

\begin{lemma}
\label{lemma-base-change-quasi-projective}
A base change of a quasi-projective morphism is quasi-projective.
\end{lemma}

\begin{proof}
This follows from
Lemmas \ref{lemma-base-change-finite-type} and
\ref{lemma-ample-base-change}.
\end{proof}

\begin{lemma}
\label{lemma-composition-quasi-projective}
Let $f : X \to Y$ and $g : Y \to S$ be morphisms of schemes.
If $S$ is quasi-compact and $f$ and $g$ are quasi-projective,
then $g \circ f$ is quasi-projective.
\end{lemma}

\begin{proof}
This follows from
Lemmas \ref{lemma-composition-finite-type} and
\ref{lemma-ample-composition}.
\end{proof}

\begin{lemma}
\label{lemma-quasi-projective-properties}
Let $f : X \to S$ be a morphism of schemes. If $f$ is quasi-projective,
or H-quasi-projective or locally quasi-projective, then $f$ is
separated of finite type.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-H-quasi-projective-quasi-projective}
A H-quasi-projective morphism is quasi-projective.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-characterize-locally-quasi-projective}
Let $f : X \to S$ be a morphism of schemes.
The following are equivalent:
\begin{enumerate}
\item The morphism $f$ is locally quasi-projective.
\item There exists an open covering $S = \bigcup V_j$ such
that each $f^{-1}(V_j) \to V_j$ is H-quasi-projective.
\end{enumerate}
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-H-quasi-projective-quasi-projective}
we see that (2) implies (1). Assume (1).
The question is local on $S$ and hence we may assume $S$ is affine,
$X$ of finite type over $S$ and
$\mathcal{L}$ is a relatively ample invertible sheaf on $X/S$.
By Lemma \ref{lemma-finite-type-over-affine-ample-very-ample}
we may assume $\mathcal{L}$ is ample on $X$.
By Lemma \ref{lemma-quasi-projective-finite-type-over-S} we see that there
exists an immersion of $X$ into
a projective space over $S$, i.e., $X$ is H-quasi-projective over $S$
as desired.
\end{proof}

\begin{lemma}
\label{lemma-quasi-affine-finite-type-quasi-projective}
\begin{reference}
\cite[II, Proposition 5.3.4 (i)]{EGA}
\end{reference}
A quasi-affine morphism of finite type is quasi-projective.
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-quasi-affine-O-ample}.
\end{proof}

\begin{lemma}
\label{lemma-quasi-projective-permanence}
Let $g : Y \to S$ and $f : X \to Y$ be morphisms of schemes.
If $g \circ f$ is quasi-projective and $f$ is
quasi-compact\footnote{This follows if $g$ is quasi-separated by
Schemes, Lemma \ref{schemes-lemma-quasi-compact-permanence}.},
then $f$ is quasi-projective.
\end{lemma}

\begin{proof}
Observe that $f$ is of finite type by
Lemma \ref{lemma-permanence-finite-type}.
Thus the lemma follows from Lemma \ref{lemma-ample-permanence}
and the definitions.
\end{proof}





\section{Proper morphisms}
\label{section-proper}

\noindent
The notion of a proper morphism plays an important role in algebraic
geometry. An important example of a proper morphism will be the
structure morphism $\mathbf{P}^n_S \to S$ of projective $n$-space,
and this is in fact the motivating example leading to the definition.

\begin{definition}
\label{definition-proper}
Let $f : X \to S$ be a morphism of schemes.
We say $f$ is {\it proper} if $f$ is separated, finite type, and
universally closed.
\end{definition}

\noindent
The morphism from the affine line with zero doubled to the affine line
is of finite type and universally closed, so the separation condition is
necessary in the definition above.
In the rest of this section we prove some of the basic properties
of proper morphisms and of universally closed morphisms.

\begin{lemma}
\label{lemma-universally-closed-local-on-the-base}
Let $f : X \to S$ be a morphism of schemes.
The following are equivalent:
\begin{enumerate}
\item The morphism $f$ is universally closed.
\item There exists an open covering $S = \bigcup V_j$ such
that $f^{-1}(V_j) \to V_j$ is universally closed for all indices $j$.
\end{enumerate}
\end{lemma}

\begin{proof}
This is clear from the definition.
\end{proof}

\begin{lemma}
\label{lemma-proper-local-on-the-base}
Let $f : X \to S$ be a morphism of schemes.
The following are equivalent:
\begin{enumerate}
\item The morphism $f$ is proper.
\item There exists an open covering $S = \bigcup V_j$ such
that $f^{-1}(V_j) \to V_j$ is proper for all indices $j$.
\end{enumerate}
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-composition-proper}
The composition of proper morphisms is proper.
The same is true for universally closed morphisms.
\end{lemma}

\begin{proof}
A composition of closed morphisms is closed.
If $X \to Y \to Z$ are universally closed morphisms
and $Z' \to Z$ is any morphism, then we see that
$Z' \times_Z X = (Z' \times_Z Y) \times_Y X  \to Z' \times_Z Y$
is closed and $Z' \times_Z Y \to Z'$ is closed.
Hence the result for universally closed morphisms.
We have seen that ``separated'' and ``finite type''
are preserved under compositions
(Schemes, Lemma \ref{schemes-lemma-separated-permanence} and
Lemma \ref{lemma-composition-finite-type}). Hence the
result for proper morphisms.
\end{proof}

\begin{lemma}
\label{lemma-base-change-proper}
The base change of a proper morphism is proper.
The same is true for universally closed morphisms.
\end{lemma}

\begin{proof}
This is true by definition for universally closed morphisms.
It is true for separated morphisms
(Schemes, Lemma \ref{schemes-lemma-separated-permanence}).
It is true for morphisms of finite type
(Lemma \ref{lemma-base-change-finite-type}).
Hence it is true for proper morphisms.
\end{proof}

\begin{lemma}
\label{lemma-closed-immersion-proper}
A closed immersion is proper, hence a fortiori universally closed.
\end{lemma}

\begin{proof}
The base change of a closed immersion is a closed immersion
(Schemes, Lemma \ref{schemes-lemma-base-change-immersion}).
Hence it is universally closed.
A closed immersion is separated
(Schemes, Lemma \ref{schemes-lemma-immersions-monomorphisms}).
A closed immersion is of finite type
(Lemma \ref{lemma-immersion-locally-finite-type}).
Hence a closed immersion is proper.
\end{proof}

\begin{lemma}
\label{lemma-image-proper-scheme-closed}
Suppose given a commutative diagram of schemes
$$
\xymatrix{
X \ar[rr] \ar[rd] & &
Y \ar[ld] \\
& S &
}
$$
with $Y$ separated over $S$.
\begin{enumerate}
\item If $X \to S$ is universally closed, then the morphism
$X \to Y$ is universally closed.
\item If $X$ is proper over $S$, then the morphism $X \to Y$ is proper.
\end{enumerate}
In particular, in both cases the image of $X$ in $Y$ is closed.
\end{lemma}

\begin{proof}
Assume that $X \to S$ is universally closed (resp.\ proper).
We factor the morphism as $X \to X \times_S Y \to Y$.
The first morphism is a closed immersion, see
Schemes, Lemma \ref{schemes-lemma-semi-diagonal}.
Hence the first morphism is proper (Lemma \ref{lemma-closed-immersion-proper}).
The projection $X \times_S Y \to Y$ is the base change
of a universally closed (resp.\ proper) morphism and hence
universally closed (resp.\ proper), see Lemma \ref{lemma-base-change-proper}.
Thus $X \to Y$ is universally closed (resp.\ proper) as the composition
of universally closed (resp.\ proper) morphisms
(Lemma \ref{lemma-composition-proper}).
\end{proof}

\noindent
The proof of the following lemma is due to Bjorn Poonen, see
\href{https://mathoverflow.net/questions/23337/is-a-universally-closed-morphism-of-schemes-quasi-compact/23528#23528}{this location}.

\begin{lemma}
\label{lemma-universally-closed-quasi-compact}
\begin{reference}
Due to Bjorn Poonen.
\end{reference}
A universally closed morphism of schemes is quasi-compact.
\end{lemma}

\begin{proof}
Let $f : X \to S$ be a morphism. Assume that $f$ is not quasi-compact.
Our goal is to show that $f$ is not universally closed. By
Schemes, Lemma \ref{schemes-lemma-quasi-compact-affine}
there exists an affine open $V \subset S$ such that $f^{-1}(V)$ is
not quasi-compact. To achieve our goal it suffices to show that
$f^{-1}(V) \to V$ is not universally closed, hence we may assume that
$S = \Spec(A)$ for some ring $A$.

\medskip\noindent
Write $X = \bigcup_{i \in I} X_i$ where the $X_i$ are affine open subschemes
of $X$.  Let $T = \Spec(A[y_i ; i \in I])$.
Let $T_i = D(y_i) \subset T$. Let $Z$ be the closed set
$(X \times_S T) - \bigcup_{i \in I} (X_i \times_S T_i)$.  It suffices to
prove that the image $f_T(Z)$ of $Z$ under $f_T : X \times_S T \to T$
is not closed.

\medskip\noindent
There exists a point $s \in S$ such that there is no
neighborhood $U$ of $s$ in $S$ such that $X_U$ is quasi-compact.
Otherwise we could cover $S$ with finitely many such $U$ and
Schemes, Lemma \ref{schemes-lemma-quasi-compact-affine}
would imply $f$ quasi-compact. Fix such an $s \in S$.

\medskip\noindent
First we check that $f_T(Z_s) \ne T_s$.  Let $t \in T$ be the point
lying over $s$ with $\kappa(t) = \kappa(s)$ such that $y_i = 1$ in
$\kappa(t)$ for all $i$.
Then $t \in T_i$ for all $i$, and the fiber of $Z_s \to T_s$ above
$t$ is isomorphic to $(X - \bigcup_{i \in I} X_i)_s$, which is empty.
Thus $t \in T_s - f_T(Z_s)$.

\medskip\noindent
Assume $f_T(Z)$ is closed in $T$. Then there exists an element
$g \in A[y_i; i \in I]$ with $f_T(Z) \subset V(g)$ but $t \not \in V(g)$.
Hence the image of $g$ in $\kappa(t)$ is nonzero. In particular some
coefficient of $g$ has nonzero image in $\kappa(s)$. Hence this coefficient is
invertible on some neighborhood $U$ of $s$. Let $J$ be the finite set of
$j \in I$ such that $y_j$ appears in $g$. Since $X_U$ is not quasi-compact,
we may choose a point $x \in X - \bigcup_{j \in J} X_j$ lying above some
$u \in U$. Since $g$ has a coefficient that is invertible on $U$, we can
find a point $t' \in T$ lying above $u$ such that $t' \not \in V(g)$ and
$t' \in V(y_i)$ for all $i \notin J$. This is true because
$V(y_i; i \in I, i \not\in J) = \Spec(A[t_j; j\in J])$
and the set of points of this scheme lying over $u$ is bijective
with $\Spec(\kappa(u)[t_j; j \in J])$. In other words $t' \notin T_i$
for each $i \notin J$. By
Schemes, Lemma \ref{schemes-lemma-points-fibre-product}
we can find a point $z$ of $X \times_S T$ mapping to $x \in X$ and to
$t' \in T$. Since $x \not \in X_j$ for $j \in J$ and $t' \not \in T_i$
for $i \in I \setminus J$ we see that $z \in Z$. On the other hand
$f_T(z) = t' \not \in V(g)$ which contradicts $f_T(Z) \subset V(g)$.
Thus the assumption ``$f_T(Z)$ closed'' is wrong and we conclude indeed
that $f_T$ is not closed, as desired.
\end{proof}

\noindent
The following lemma says that the image of a proper scheme (in a separated
scheme of finite type over the base) is proper.

\begin{lemma}
\label{lemma-image-proper-is-proper}
Let $S$ be a scheme. Let $f : X \to Y$ be a morphism of schemes over $S$.
If $X$ is universally closed over $S$ and $f$ is surjective then
$Y$ is universally closed over $S$. In particular, if also $Y$ is
separated and locally of finite type over $S$, then $Y$ is proper over $S$.
\end{lemma}

\begin{proof}
Assume $X$ is universally closed and $f$ surjective.
Denote $p : X \to S$, $q : Y \to S$ the structure morphisms.
Let $S' \to S$ be a morphism of schemes. The base change
$f' : X_{S'} \to Y_{S'}$ is surjective
(Lemma \ref{lemma-base-change-surjective}), and the base
change $p' : X_{S'} \to S'$ is closed.
If $T \subset Y_{S'}$ is closed, then $(f')^{-1}(T) \subset X_{S'}$
is closed, hence $p'((f')^{-1}(T)) = q'(T)$ is closed.
So $q'$ is closed. This proves the first statement.
Thus $Y \to S$ is quasi-compact by
Lemma \ref{lemma-universally-closed-quasi-compact}
and hence $Y \to S$ is proper by definition
if in addition $Y \to S$ is locally of finite type and separated.
\end{proof}

\begin{lemma}
\label{lemma-scheme-theoretic-image-is-proper}
Suppose given a commutative diagram of schemes
$$
\xymatrix{
X \ar[rr]_h \ar[rd]_f & & Y \ar[ld]^g \\
& S
}
$$
Assume
\begin{enumerate}
\item $X \to S$ is a universally closed (for example proper) morphism, and
\item $Y \to S$ is separated and locally of finite type.
\end{enumerate}
Then the scheme theoretic image $Z \subset Y$ of $h$
is proper over $S$ and $X \to Z$ is surjective.
\end{lemma}

\begin{proof}
The scheme theoretic image of $h$ is constructed in Section
\ref{section-scheme-theoretic-image}. Since $f$ is quasi-compact
(Lemma \ref{lemma-universally-closed-quasi-compact})
we find that $h$ is quasi-compact
(Schemes, Lemma \ref{schemes-lemma-quasi-compact-permanence}).
Hence $h(X) \subset Z$
is dense (Lemma \ref{lemma-quasi-compact-scheme-theoretic-image}).
On the other hand $h(X)$ is closed in $Y$
(Lemma \ref{lemma-image-proper-scheme-closed})
hence $X \to Z$ is surjective.
Thus $Z \to S$ is a proper (Lemma \ref{lemma-image-proper-is-proper}).
\end{proof}

\noindent
The target of a separated scheme under a surjective
universally closed morphism is separated.

\begin{lemma}
\label{lemma-image-universally-closed-separated}
Let $S$ be a scheme. Let $f : X \to Y$ be a surjective universally closed
morphism of schemes over $S$.
\begin{enumerate}
\item If $X$ is quasi-separated, then $Y$ is quasi-separated.
\item If $X$ is separated, then $Y$ is separated.
\item If $X$ is quasi-separated over $S$, then $Y$ is quasi-separated over $S$.
\item If $X$ is separated over $S$, then $Y$ is separated over $S$.
\end{enumerate}
\end{lemma}

\begin{proof}
Parts (1) and (2) are a consequence of (3) and (4) for
$S = \Spec(\mathbf{Z})$ (see
Schemes, Definition \ref{schemes-definition-separated}).
Consider the commutative diagram
$$
\xymatrix{
X \ar[d] \ar[rr]_{\Delta_{X/S}} & & X \times_S X \ar[d] \\
Y \ar[rr]^{\Delta_{Y/S}} & & Y \times_S Y
}
$$
The left vertical arrow is surjective (i.e., universally surjective).
The right vertical arrow is universally closed as a composition
of the universally closed morphisms
$X \times_S X \to X \times_S Y \to Y \times_S Y$. Hence it is also
quasi-compact, see
Lemma \ref{lemma-universally-closed-quasi-compact}.

\medskip\noindent
Assume $X$ is quasi-separated over $S$, i.e.,  $\Delta_{X/S}$ is
quasi-compact. If $V \subset Y \times_S Y$ is a quasi-compact
open, then $V \times_{Y \times_S Y} X \to \Delta_{Y/S}^{-1}(V)$
is surjective and $V \times_{Y \times_S Y} X$ is quasi-compact by our remarks
above. We conclude that $\Delta_{Y/S}$ is quasi-compact, i.e., $Y$
is quasi-separated over $S$.

\medskip\noindent
Assume $X$ is separated over $S$, i.e., $\Delta_{X/S}$ is a closed
immersion. Then $X \to Y \times_S Y$ is closed as a
composition of closed morphisms. Since $X \to Y$ is
surjective, it follows that $\Delta_{Y/S}(Y)$ is closed in $Y \times_S Y$.
Hence $Y$ is separated over $S$ by the discussion following
Schemes, Definition \ref{schemes-definition-separated}.
\end{proof}








\section{Valuative criteria}
\label{section-valuative-criteria}

\noindent
We have already discussed the valuative criterion for universal closedness
and for separatedness in Schemes, Sections
\ref{schemes-section-valuative-criterion-universal-closedness} and
\ref{schemes-section-valuative-separatedness}.
In this section we will discuss some consequences and variants.
In Limits, Section \ref{limits-section-Noetherian-valuative-criterion}
we will show that it suffices to consider discrete valuation
rings when working with locally Noetherian schemes and
morphisms of finite type.

\begin{lemma}[Valuative criterion for properness]
\label{lemma-characterize-proper}
\begin{reference}
\cite[II Theorem 7.3.8]{EGA}
\end{reference}
Let $S$ be a scheme. Let $f : X \to Y$ be a morphism of schemes
over $S$. Assume $f$ is of finite type and quasi-separated.
Then the following are equivalent
\begin{enumerate}
\item $f$ is proper,
\item $f$ satisfies the valuative criterion
(Schemes, Definition \ref{schemes-definition-valuative-criterion}),
\item given any commutative solid diagram
$$
\xymatrix{
\Spec(K) \ar[r] \ar[d] & X \ar[d] \\
\Spec(A) \ar[r] \ar@{-->}[ru] & Y
}
$$
where $A$ is a valuation ring with field of fractions $K$, there exists
a unique dotted arrow making the diagram commute.
\end{enumerate}
\end{lemma}

\begin{proof}
Part (3) is a reformulation of (2). Thus the lemma is a formal
consequence of
Schemes, Proposition \ref{schemes-proposition-characterize-universally-closed}
and Lemma \ref{schemes-lemma-valuative-criterion-separatedness}
and the definitions.
\end{proof}

\noindent
One usually does not have to consider all possible diagrams
when testing the valuative criterion. We will call a valuative
criterion as in the next lemma a ``refined valuative criterion''.

\begin{lemma}
\label{lemma-refined-valuative-criterion-universally-closed}
Let $f : X \to S$ and $h : U \to X$ be morphisms of schemes.
Assume that $f$ and $h$ are quasi-compact and that $h(U)$ is dense in $X$.
If given any commutative solid diagram
$$
\xymatrix{
\Spec(K) \ar[r] \ar[d] & U \ar[r]^h & X \ar[d]^f \\
\Spec(A) \ar[rr] \ar@{-->}[rru] & & S
}
$$
where $A$ is a valuation ring with field of fractions $K$, there
exists a unique dotted arrow making the diagram commute, then $f$
is universally closed. If moreover $f$ is quasi-separated, then
$f$ is separated.
\end{lemma}

\begin{proof}
To prove $f$ is universally closed we will verify the existence part of the
valuative criterion for $f$ which suffices by
Schemes, Proposition \ref{schemes-proposition-characterize-universally-closed}.
To do this, consider a commutative diagram
$$
\xymatrix{
\Spec(K) \ar[r] \ar[d] & X \ar[d] \\
\Spec(A) \ar[r] & S
}
$$
where $A$ is a valuation ring and $K$ is the fraction field of $A$.
Note that since valuation rings and fields are reduced, we may
replace $U$, $X$, and $S$ by their respective reductions
by Schemes, Lemma \ref{schemes-lemma-map-into-reduction}.
In this case the assumption that $h(U)$ is dense means that
the scheme theoretic image of $h : U \to X$ is $X$, see
Lemma \ref{lemma-scheme-theoretic-image-reduced}.
We may also replace $S$ by an affine open through which
the morphism $\Spec(A) \to S$ factors. Thus we may
assume that $S = \Spec(R)$.

\medskip\noindent
Let $\Spec(B) \subset X$ be an affine open through which
the morphism $\Spec(K) \to X$ factors. Choose a polynomial
algebra $P$ over $B$ and a $B$-algebra surjection $P \to K$.
Then $\Spec(P) \to X$ is flat. Hence the scheme theoretic image
of the morphism $U \times_X \Spec(P) \to \Spec(P)$ is $\Spec(P)$ by
Lemma \ref{lemma-flat-base-change-scheme-theoretic-image}.
By Lemma \ref{lemma-reach-points-scheme-theoretic-image}
we can find a commutative diagram
$$
\xymatrix{
\Spec(K') \ar[r] \ar[d] & U \times_X \Spec(P) \ar[d] \\
\Spec(A') \ar[r] & \Spec(P)
}
$$
where $A'$ is a valuation ring and $K'$ is the fraction field of $A'$
such that the closed point of $\Spec(A')$ maps to $\Spec(K) \subset \Spec(P)$.
In other words, there is a $B$-algebra map
$\varphi : K \to A'/\mathfrak m_{A'}$. Choose a valuation ring
$A'' \subset A'/\mathfrak m_{A'}$ dominating $\varphi(A)$ with
field of fractions $K'' = A'/\mathfrak m_{A'}$
(Algebra, Lemma \ref{algebra-lemma-dominate}). We set
$$
C = \{\lambda \in A' \mid \lambda \bmod \mathfrak m_{A'} \in A''\}.
$$
which is a valuation ring by
Algebra, Lemma \ref{algebra-lemma-stack-valuation-rings}.
As $C$ is an $R$-algebra with fraction field $K'$, we obtain a
commutative diagram
$$
\xymatrix{
\Spec(K') \ar[r] \ar[d] & U \ar[r] & X \ar[d] \\
\Spec(C) \ar[rr] \ar@{-->}[rru] & & S
}
$$
as in the statement of the lemma. Thus a dotted arrow fitting into
the diagram as indicated. By the uniqueness assumption of the lemma
the composition $\Spec(A') \to \Spec(C) \to X$ agrees with the
given morphism $\Spec(A') \to \Spec(P) \to \Spec(B) \subset X$.
Hence the restriction of the morphism to the spectrum of
$C/\mathfrak m_{A'} = A''$ induces the given morphism
$\Spec(K'') = \Spec(A'/\mathfrak m_{A'}) \to \Spec(K) \to X$.
Let $x \in X$ be the image of the closed point of $\Spec(A'') \to X$.
The image of the induced ring map $\mathcal{O}_{X, x} \to A''$
is a local subring which is contained in $K \subset K''$.
Since $A$ is maximal for the relation of domination in $K$
and since $A \subset A''$, we have $A = K \cap A''$. We conclude
that $\mathcal{O}_{X, x} \to A''$ factors through $A \subset A''$.
In this way we obtain our desired arrow $\Spec(A) \to X$.

\medskip\noindent
Finally, assume $f$ is quasi-separated. Then $\Delta : X \to X \times_S X$
is quasi-compact. Given a solid diagram
$$
\xymatrix{
\Spec(K) \ar[r] \ar[d] & U \ar[r]^h & X \ar[d]^\Delta \\
\Spec(A) \ar[rr] \ar@{-->}[rru] & & X \times_S X
}
$$
where $A$ is a valuation ring with field of fractions $K$, there
exists a unique dotted arrow making the diagram commute. Namely,
the lower horizontal arrow is the same thing as a pair of morphisms
$\Spec(A) \to X$ which can serve as the dotted arrow in the diagram
of the lemma. Thus the required uniqueness shows that the lower
horizontal arrow factors through $\Delta$.
Hence we can apply the result we just proved to
$\Delta : X \to X \times_S X$ and $h : U \to X$ and conclude that
$\Delta$ is universally closed. Clearly this means that $f$
is separated.
\end{proof}

\begin{remark}
\label{remark-check-val-on-open}
The assumption on uniqueness of the dotted arrows in
Lemma \ref{lemma-refined-valuative-criterion-universally-closed}
is necessary (details omitted). Of course, uniqueness is guaranteed if
$f$ is separated
(Schemes, Lemma \ref{schemes-lemma-separated-implies-valuative}).
\end{remark}

\begin{lemma}
\label{lemma-morphism-defined-local-ring}
Let $S$ be a scheme. Let $X$, $Y$ be schemes over $S$.
Let $s \in S$ and $x \in X$, $y \in Y$ points over $s$.
\begin{enumerate}
\item Let $f, g : X \to Y$ be morphisms over $S$ such that
$f(x) = g(x) = y$ and
$f^\sharp_x = g^\sharp_x : \mathcal{O}_{Y, y} \to \mathcal{O}_{X, x}$.
Then there is an open neighbourhood $U \subset X$ with
$f|_U = g|_U$ in the following cases
\begin{enumerate}
\item $Y$ is locally of finite type over $S$,
\item $X$ is integral,
\item $X$ is locally Noetherian, or
\item $X$ is reduced with finitely many irreducible components.
\end{enumerate}
\item Let $\varphi : \mathcal{O}_{Y, y} \to \mathcal{O}_{X, x}$
be a local $\mathcal{O}_{S, s}$-algebra map. Then there exists
an open neighbourhood $U \subset X$ of $x$ and a morphism $f : U \to Y$
mapping $x$ to $y$ with $f^\sharp_x = \varphi$ in the following cases
\begin{enumerate}
\item $Y$ is locally of finite presentation over $S$,
\item $Y$ is locally of finite type and $X$ is integral,
\item $Y$ is locally of finite type and $X$ is locally Noetherian, or
\item $Y$ is locally of finite type and $X$ is reduced with finitely
many irreducible components.
\end{enumerate}
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). We may replace $X$, $Y$, $S$ by suitable affine open
neighbourhoods of $x$, $y$, $s$ and reduce to the following algebra
problem: given a ring $R$, two $R$-algebra maps $\varphi, \psi : B \to A$
such that
\begin{enumerate}
\item $R \to B$ is of finite type, or $A$ is a domain, or $A$
is Noetherian, or $A$ is reduced and has finitely many minimal primes,
\item the two maps $B \to A_\mathfrak p$ are the same for
some prime $\mathfrak p \subset A$,
\end{enumerate}
show that $\varphi, \psi$ define the same map $B \to A_g$ for
a suitable $g \in A$, $g \not \in \mathfrak p$. If $R \to B$ is of
finite type, let $t_1, \ldots, t_m \in B$ be generators of $B$
as an $R$-algebra. For each $j$ we can find
$g_j \in A$, $g_j \not \in \mathfrak p$
such that $\varphi(t_j)$ and $\psi(t_j)$ have the same image in
$A_{g_j}$. Then we set $g = \prod g_j$.
In the other cases (if $A$ is a domain, Noetherian, or reduced
with finitely many minimal primes), we can find a $g \in A$,
$g \not \in \mathfrak p$ such that $A_g \subset A_\mathfrak p$.
See Algebra, Lemma \ref{algebra-lemma-subring-of-local-ring}.
Thus the maps $B \to A_g$ are equal as desired.

\medskip\noindent
Proof of (2). To do this we may replace $X$, $Y$, and $S$ by suitable affine
opens. Say $X = \Spec(A)$, $Y = \Spec(B)$, and $S = \Spec(R)$.
Let $\mathfrak p \subset A$ be the prime ideal corresponding to $x$.
Let $\mathfrak q \subset B$ be the prime corresponding to $y$.
Then $\varphi$ is a local $R$-algebra map
$\varphi : B_\mathfrak q \to A_\mathfrak p$.
If $R \to B$ is a ring map of finite presentation, then there exists a
$g \in A \setminus \mathfrak p$ and an $R$-algebra map $B \to A_g$ such that
$$
\xymatrix{
B_\mathfrak q \ar[r]_\varphi & A_\mathfrak p \\
B \ar[u] \ar[r] & A_g \ar[u]
}
$$
commutes, see
Algebra, Lemmas \ref{algebra-lemma-characterize-finite-presentation} and
\ref{algebra-lemma-localization-colimit}.
The induced morphism $\Spec(A_g) \to \Spec(B)$ works.
If $B$ is of finite type over $R$, let $t_1, \ldots, t_m \in B$ be
generators of $B$ as an $R$-algebra. Then we can choose
$g_j \in A$, $g_j \not \in \mathfrak p$
such that $\varphi(t_j) \in \Im(A_{g_j} \to A_\mathfrak p)$.
Thus after replacing $A$ by $A[1/\prod g_j]$ we may assume
that $B$ maps into the image of $A \to A_\mathfrak p$.
If we can find a $g \in A$, $g \not \in \mathfrak p$
such that $A_g \to A_\mathfrak p$ is injective, then
we'll get the desired $R$-algebra map $B \to A_g$.
Thus the proof is finished by another application of
See Algebra, Lemma \ref{algebra-lemma-subring-of-local-ring}.
\end{proof}

\begin{lemma}
\label{lemma-extend-across}
Let $S$ be a scheme. Let $X$, $Y$ be schemes over $S$. Let $x \in X$.
Let $U \subset X$ be an open and let $f : U \to Y$ be a morphism over $S$.
Assume
\begin{enumerate}
\item $x$ is in the closure of $U$,
\item $X$ is reduced with finitely many irreducible components or
$X$ is Noetherian,
\item $\mathcal{O}_{X, x}$ is a valuation ring,
\item $Y \to S$ is proper
\end{enumerate}
Then there exists an open $U \subset U' \subset X$ containing
$x$ and an $S$-morphism $f' : U' \to Y$ extending $f$.
\end{lemma}

\begin{proof}
It is harmless to replace $X$ by an open neighbourhood of $x$ in $X$
(small detail omitted). By Properties, Lemma
\ref{properties-lemma-ring-affine-open-injective-local-ring}
we may assume $X$ is affine with
$\Gamma(X, \mathcal{O}_X) \subset \mathcal{O}_{X, x}$.
In particular $X$ is integral with a unique generic point $\xi$
whose residue field is the fraction field $K$ of the
valuation ring $\mathcal{O}_{X, x}$.
Since $x$ is in the closure of $U$ we see that $U$ is not
empty, hence $U$ contains $\xi$. Thus by the valuative criterion
of properness (Lemma \ref{lemma-characterize-proper})
there is a morphism $t : \Spec(\mathcal{O}_{X, x}) \to Y$
fitting into a commutative diagram
$$
\xymatrix{
\Spec(K) \ar[d]_\xi \ar[r] & \Spec(\mathcal{O}_{X, x}) \ar[d]_t \\
U \ar[r]^f & Y
}
$$
of morphisms of schemes over $S$. Applying
Lemma \ref{lemma-morphism-defined-local-ring}
with $y = t(x)$ and $\varphi = t^\sharp_x$ we obtain an open
neighbourhood $V \subset X$ of $x$ and a morphism $g : V \to Y$
over $S$ which sends $x$ to $y$ and such that $g^\sharp_x = t^\sharp_x$.
As $Y \to S$ is separated, the equalizer $E$ of $f|_{U \cap V}$
and $g|_{U \cap V}$ is a closed subscheme of $U \cap V$, see
Schemes, Lemma \ref{schemes-lemma-where-are-they-equal}.
Since $f$ and $g$ determine the same morphism $\Spec(K) \to Y$
by construction we see that $E$ contains the generic point
of the integral scheme $U \cap V$. Hence $E = U \cap V$ and
we conclude that $f$ and $g$ glue to a morphism $U' = U \cup V \to Y$
as desired.
\end{proof}





\section{Projective morphisms}
\label{section-projective}

\noindent
We will use the definition of a projective morphism from \cite{EGA}.
The version of the definition with the ``H'' is the one
from \cite{H}. The resulting definitions are different. Both are useful.

\begin{definition}
\label{definition-projective}
Let $f : X \to S$ be a morphism of schemes.
\begin{enumerate}
\item We say $f$ is {\it projective} if $X$ is isomorphic as
an $S$-scheme to a closed subscheme of a projective
bundle $\mathbf{P}(\mathcal{E})$
for some quasi-coherent, finite type $\mathcal{O}_S$-module $\mathcal{E}$.
\item We say $f$ is {\it H-projective} if there exists an integer $n$ and
a closed immersion $X \to \mathbf{P}^n_S$ over $S$.
\item We say $f$ is {\it locally projective} if there exists an open
covering $S = \bigcup U_i$ such that each $f^{-1}(U_i) \to U_i$ is
projective.
\end{enumerate}
\end{definition}

\noindent
As expected, a projective morphism is quasi-projective, see
Lemma \ref{lemma-projective-quasi-projective}.
Conversely, quasi-projective morphisms are often compositions
of open immersions and projective morphisms, see
Lemma \ref{lemma-quasi-projective-open-projective}.
For an overview of properties of projective morphisms over
a quasi-projective base, see
More on Morphisms, Section \ref{more-morphisms-section-projective}.

\begin{example}
\label{example-projective}
Let $S$ be a scheme. Let $\mathcal{A}$ be a quasi-coherent graded
$\mathcal{O}_S$-algebra generated by $\mathcal{A}_1$ over $\mathcal{A}_0$.
Assume furthermore that $\mathcal{A}_1$ is of finite type over
$\mathcal{O}_S$. Set $X = \underline{\text{Proj}}_S(\mathcal{A})$.
In this case $X \to S$ is projective. Namely,
the morphism associated to the graded $\mathcal{O}_S$-algebra map
$$
\text{Sym}_{\mathcal{O}_X}^*(\mathcal{A}_1)
\longrightarrow
\mathcal{A}
$$
is a closed immersion, see
Constructions, Lemma
\ref{constructions-lemma-surjective-generated-degree-1-map-relative-proj}.
\end{example}
 
\begin{lemma}
\label{lemma-H-projective}
An H-projective morphism is H-quasi-projective.
An H-projective morphism is projective.
\end{lemma}

\begin{proof}
The first statement is immediate from the definitions.
The second holds as $\mathbf{P}^n_S$ is a projective bundle over $S$, see
Constructions, Lemma \ref{constructions-lemma-projective-space-bundle}.
\end{proof}

\begin{lemma}
\label{lemma-characterize-locally-projective}
Let $f : X \to S$ be a morphism of schemes.
The following are equivalent:
\begin{enumerate}
\item The morphism $f$ is locally projective.
\item There exists an open covering $S = \bigcup U_i$ such
that each $f^{-1}(U_i) \to U_i$ is H-projective.
\end{enumerate}
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-H-projective} we see that (2) implies (1). Assume (1).
For every point $s \in S$ we can find $\Spec(R) = U \subset S$
an affine open neighbourhood of $s$ such that $X_U$ is isomorphic to a
closed subscheme of $\mathbf{P}(\mathcal{E})$ for some finite type,
quasi-coherent sheaf of $\mathcal{O}_U$-modules $\mathcal{E}$.
Write $\mathcal{E} = \widetilde{M}$ for some finite type
$R$-module $M$ (see
Properties, Lemma \ref{properties-lemma-finite-type-module}).
Choose generators $x_0, \ldots, x_n \in M$ of $M$ as an $R$-module.
Consider the surjective graded $R$-algebra map
$$
R[X_0, \ldots, X_n] \longrightarrow \text{Sym}_R(M).
$$
According to
Constructions, Lemma \ref{constructions-lemma-surjective-graded-rings-map-proj}
the corresponding morphism
$$
\mathbf{P}(\mathcal{E}) \to \mathbf{P}^n_R
$$
is a closed immersion. Hence we conclude that $f^{-1}(U)$ is isomorphic
to a closed subscheme of $\mathbf{P}^n_U$ (as a scheme over $U$).
In other words: (2) holds.
\end{proof}

\begin{lemma}
\label{lemma-locally-projective-proper}
A locally projective morphism is proper.
\end{lemma}

\begin{proof}
Let $f : X \to S$ be locally projective.
In order to show that $f$ is proper we may work locally on the
base, see Lemma \ref{lemma-proper-local-on-the-base}.
Hence, by Lemma \ref{lemma-characterize-locally-projective}
above we may assume there exists a closed immersion $X \to \mathbf{P}^n_S$.
By Lemmas \ref{lemma-composition-proper}
and \ref{lemma-closed-immersion-proper} it suffices to prove that
$\mathbf{P}^n_S \to S$ is proper. Since
$\mathbf{P}^n_S \to S$ is the base change of
$\mathbf{P}^n_{\mathbf{Z}} \to \Spec(\mathbf{Z})$ it suffices
to show that $\mathbf{P}^n_{\mathbf{Z}} \to \Spec(\mathbf{Z})$
is proper, see Lemma \ref{lemma-base-change-proper}.
By Constructions, Lemma \ref{constructions-lemma-proj-separated} the scheme
$\mathbf{P}^n_{\mathbf{Z}}$ is separated.
By Constructions, Lemma \ref{constructions-lemma-proj-quasi-compact} the scheme
$\mathbf{P}^n_{\mathbf{Z}}$ is quasi-compact.
It is clear that $\mathbf{P}^n_{\mathbf{Z}} \to \Spec(\mathbf{Z})$
is locally of finite type since $\mathbf{P}^n_{\mathbf{Z}}$ is
covered by the affine opens $D_{+}(X_i)$ each of which is the
spectrum of the finite type $\mathbf{Z}$-algebra
$$
\mathbf{Z}[X_0/X_i, \ldots, X_n/X_i].
$$
Finally, we have to show that
$\mathbf{P}^n_{\mathbf{Z}} \to \Spec(\mathbf{Z})$
is universally closed. This follows from
Constructions, Lemma \ref{constructions-lemma-proj-valuative-criterion}
and the valuative criterion (see Schemes,
Proposition \ref{schemes-proposition-characterize-universally-closed}).
\end{proof}

\begin{lemma}
\label{lemma-proper-ample-locally-projective}
Let $f : X \to S$ be a proper morphism of schemes. If there exists
an $f$-ample invertible sheaf on $X$, then $f$ is locally projective.
\end{lemma}

\begin{proof}
If there exists an $f$-ample invertible sheaf, then we can locally
on $S$ find an immersion $i : X \to \mathbf{P}^n_S$, see
Lemma \ref{lemma-finite-type-over-affine-ample-very-ample}. Since $X \to S$
is proper the morphism $i$ is a closed immersion, see
Lemma \ref{lemma-image-proper-scheme-closed}.
\end{proof}

\begin{lemma}
\label{lemma-H-projective-composition}
A composition of H-projective morphisms is H-projective.
\end{lemma}

\begin{proof}
Suppose $X \to Y$ and $Y \to Z$ are H-projective.
Then there exist closed immersions $X \to \mathbf{P}^n_Y$
over $Y$, and $Y \to \mathbf{P}^m_Z$ over $Z$.
Consider the following diagram
$$
\xymatrix{
X \ar[r] \ar[d] &
\mathbf{P}^n_Y \ar[r] \ar[dl] &
\mathbf{P}^n_{\mathbf{P}^m_Z} \ar[dl] \ar@{=}[r] &
\mathbf{P}^n_Z \times_Z \mathbf{P}^m_Z \ar[r] &
\mathbf{P}^{nm + n + m}_Z \ar[ddllll] \\
Y \ar[r] \ar[d] & \mathbf{P}^m_Z \ar[dl] & \\
Z & &
}
$$
Here the rightmost top horizontal arrow is the Segre embedding,
see Constructions, Lemma \ref{constructions-lemma-segre-embedding}.
The diagram identifies
$X$ as a closed subscheme of $\mathbf{P}^{nm + n + m}_Z$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-H-projective-base-change}
A base change of a H-projective morphism is H-projective.
\end{lemma}

\begin{proof}
This is true because the base change of projective space
over a scheme is projective space, and the fact that the base
change of a closed immersion is a closed immersion, see
Schemes, Lemma \ref{schemes-lemma-base-change-immersion}.
\end{proof}

\begin{lemma}
\label{lemma-base-change-projective}
A base change of a (locally) projective morphism is (locally) projective.
\end{lemma}

\begin{proof}
This is true because the base change of a projective bundle
over a scheme is a projective bundle, the pullback of
a finite type $\mathcal{O}$-module is of finite type
(Modules, Lemma \ref{modules-lemma-pullback-finite-type})
and the fact that the base
change of a closed immersion is a closed immersion, see
Schemes, Lemma \ref{schemes-lemma-base-change-immersion}.
Some details omitted.
\end{proof}

\begin{lemma}
\label{lemma-projective-quasi-projective}
A projective morphism is quasi-projective.
\end{lemma}

\begin{proof}
Let $f : X \to S$ be a projective morphism. Choose a closed immersion
$i : X \to \mathbf{P}(\mathcal{E})$ where $\mathcal{E}$ is a quasi-coherent,
finite type $\mathcal{O}_S$-module. Then
$\mathcal{L} = i^*\mathcal{O}_{\mathbf{P}(\mathcal{E})}(1)$ is $f$-very ample.
Since $f$ is proper (Lemma \ref{lemma-locally-projective-proper})
it is quasi-compact. Hence Lemma \ref{lemma-ample-very-ample} implies
that $\mathcal{L}$ is $f$-ample. Since $f$ is proper it is of finite type.
Thus we've checked all the defining properties of quasi-projective
holds and we win.
\end{proof}

\begin{lemma}
\label{lemma-H-quasi-projective-open-H-projective}
Let $f : X \to S$ be a H-quasi-projective morphism.
Then $f$ factors as $X \to X' \to S$ where $X \to X'$ is an
open immersion and $X' \to S$ is H-projective.
\end{lemma}

\begin{proof}
By definition we can factor $f$ as a quasi-compact immersion
$i : X \to \mathbf{P}^n_S$ followed by the projection $\mathbf{P}^n_S \to S$.
By Lemma \ref{lemma-quasi-compact-immersion} there exists a closed
subscheme $X' \subset \mathbf{P}^n_S$ such that $i$ factors through
an open immersion $X \to X'$. The lemma follows.
\end{proof}

\begin{lemma}
\label{lemma-quasi-projective-open-projective}
Let $f : X \to S$ be a quasi-projective morphism with $S$ quasi-compact
and quasi-separated. Then $f$ factors as $X \to X' \to S$ where $X \to X'$
is an open immersion and $X' \to S$ is projective.
\end{lemma}

\begin{proof}
Let $\mathcal{L}$ be $f$-ample. Since $f$ is of finite type and $S$ is
quasi-compact $\mathcal{L}^{\otimes n}$ is $f$-very ample for some $n > 0$, see
Lemma \ref{lemma-finite-type-ample-very-ample}.
Replace $\mathcal{L}$ by $\mathcal{L}^{\otimes n}$.
Write $\mathcal{F} = f_*\mathcal{L}$. This is a quasi-coherent
$\mathcal{O}_S$-module by 
Schemes, Lemma \ref{schemes-lemma-push-forward-quasi-coherent}
(quasi-projective morphisms are quasi-compact and
separated, see Lemma \ref{lemma-quasi-projective-properties}). By
Properties, Lemma \ref{properties-lemma-directed-colimit-finite-presentation}
we can find a directed set $I$ and a system of
finite type quasi-coherent $\mathcal{O}_S$-modules $\mathcal{E}_i$
over $I$ such that $\mathcal{F} = \colim \mathcal{E}_i$.
Consider the compositions
$\psi_i : f^*\mathcal{E}_i \to f^*\mathcal{F} \to \mathcal{L}$.
Choose a finite affine open covering $S = \bigcup_{j = 1, \ldots, m} V_j$.
For each $j$ we can choose sections
$$
s_{j, 0}, \ldots, s_{j, n_j} \in
\Gamma(f^{-1}(V_j), \mathcal{L}) = f_*\mathcal{L}(V_j) = \mathcal{F}(V_j)
$$
which generate $\mathcal{L}$ over $f^{-1}V_j$ and define an immersion
$$
f^{-1}V_j \longrightarrow \mathbf{P}^{n_j}_{V_j},
$$
see Lemma \ref{lemma-very-ample-finite-type-over-affine}.
Choose $i$ such that there exist sections $e_{j, t} \in \mathcal{E}_i(V_j)$
mapping to $s_{j, t}$ in $\mathcal{F}$ for all $j = 1, \ldots, m$ and
$t = 1, \ldots, n_j$. Then the map $\psi_i$ is surjective
as the sections $f^*e_{j, t}$ have the same image as the sections $s_{j, t}$
which generate $\mathcal{L}|_{f^{-1}V_j}$. Whence we obtain a morphism
$$
r_{\mathcal{L}, \psi_i} : X \longrightarrow \mathbf{P}(\mathcal{E}_i)
$$
over $S$ such that over $V_j$ we have a factorization
$$
f^{-1}V_j \to \mathbf{P}(\mathcal{E}_i)|_{V_j} \to \mathbf{P}^{n_j}_{V_j}
$$
of the immersion given above. It follows that $r_{\mathcal{L}, \psi_i}|_{V_j}$
is an immersion, see Lemma \ref{lemma-immersion-permanence}.
Since $S = \bigcup V_j$ we conclude that $r_{\mathcal{L}, \psi_i}$
is an immersion.
Note that $r_{\mathcal{L}, \psi_i}$ is quasi-compact as
$X \to S$ is quasi-compact and $\mathbf{P}(\mathcal{E}_i) \to S$ is separated
(see Schemes, Lemma \ref{schemes-lemma-quasi-compact-permanence}).
By Lemma \ref{lemma-quasi-compact-immersion} there exists a closed
subscheme $X' \subset \mathbf{P}(\mathcal{E}_i)$ such that $i$ factors
through an open immersion $X \to X'$. Then $X' \to S$ is projective
by definition and we win.
\end{proof}

\begin{lemma}
\label{lemma-projective-is-quasi-projective-proper}
Let $S$ be a quasi-compact and quasi-separated scheme.
Let $f : X \to S$ be a morphism of schemes. Then
\begin{enumerate}
\item $f$ is projective if and only if $f$ is quasi-projective and proper, and
\item $f$ is H-projective if and only if $f$ is H-quasi-projective and proper.
\end{enumerate}
\end{lemma}

\begin{proof}
If $f$ is projective, then $f$ is quasi-projective by
Lemma \ref{lemma-projective-quasi-projective} and proper by
Lemma \ref{lemma-locally-projective-proper}. Conversely, if
$X \to S$ is quasi-projective and proper, then we can choose
an open immersion $X \to X'$ with $X' \to S$ projective by
Lemma \ref{lemma-quasi-projective-open-projective}.
Since $X \to S$ is proper, we see that $X$ is closed in $X'$
(Lemma \ref{lemma-image-proper-scheme-closed}), i.e.,
$X \to X'$ is a (open and) closed immersion.
Since $X'$ is isomorphic to a closed subscheme of a projective
bundle over $S$ (Definition \ref{definition-projective})
we see that the same thing is true for $X$, i.e.,
$X \to S$ is a projective morphism. This proves (1).
The proof of (2) is the same, except it uses
Lemmas \ref{lemma-H-projective} and
\ref{lemma-H-quasi-projective-open-H-projective}.
\end{proof}

\begin{lemma}
\label{lemma-composition-projective}
Let $f : X \to Y$ and $g : Y \to S$ be morphisms of schemes.
If $S$ is quasi-compact and quasi-separated and $f$ and $g$ are projective,
then $g \circ f$ is projective.
\end{lemma}

\begin{proof}
By Lemmas \ref{lemma-projective-quasi-projective} and
\ref{lemma-locally-projective-proper}
we see that $f$ and $g$ are quasi-projective and proper.
By Lemmas \ref{lemma-composition-proper} and
\ref{lemma-composition-quasi-projective}
we see that $g \circ f$ is proper and quasi-projective.
Thus $g \circ f$ is projective by
Lemma \ref{lemma-projective-is-quasi-projective-proper}.
\end{proof}

\begin{lemma}
\label{lemma-projective-permanence}
Let $g : Y \to S$ and $f : X \to Y$ be morphisms of schemes.
If $g \circ f$ is projective and $g$ is separated,
then $f$ is projective.
\end{lemma}

\begin{proof}
Choose a closed immersion $X \to \mathbf{P}(\mathcal{E})$ where $\mathcal{E}$
is a quasi-coherent, finite type $\mathcal{O}_S$-module. Then
we get a morphism $X \to \mathbf{P}(\mathcal{E}) \times_S Y$.
This morphism is a closed immersion because it is the composition
$$
X \to X \times_S Y \to \mathbf{P}(\mathcal{E}) \times_S Y
$$
where the first morphism is a closed immersion by
Schemes, Lemma \ref{schemes-lemma-semi-diagonal}
(and the fact that $g$ is separated) and
the second as the base change of a closed immersion.
Finally, the fibre product $\mathbf{P}(\mathcal{E}) \times_S Y$
is isomorphic to $\mathbf{P}(g^*\mathcal{E})$ and pullback
preserves quasi-coherent, finite type modules.
\end{proof}

\begin{lemma}
\label{lemma-projective-over-quasi-projective-is-H-projective}
Let $S$ be a scheme which admits an ample invertible sheaf. Then
\begin{enumerate}
\item any projective morphism $X \to S$ is H-projective, and
\item any quasi-projective morphism $X \to S$ is H-quasi-projective.
\end{enumerate}
\end{lemma}

\begin{proof}
The assumptions on $S$ imply that $S$ is quasi-compact and separated, see
Properties, Definition \ref{properties-definition-ample} and
Lemma \ref{properties-lemma-ample-immersion-into-proj}
and Constructions, Lemma \ref{constructions-lemma-proj-separated}.
Hence Lemma \ref{lemma-quasi-projective-open-projective}
applies and we see that (1) implies (2).
Let $\mathcal{E}$ be a finite type quasi-coherent $\mathcal{O}_S$-module.
By our definition of projective morphisms it suffices to show that
$\mathbf{P}(\mathcal{E}) \to S$ is H-projective.
If $\mathcal{E}$ is generated by finitely many global sections,
then the corresponding surjection $\mathcal{O}_S^{\oplus n} \to \mathcal{E}$
induces a closed immersion
$$
\mathbf{P}(\mathcal{E}) \longrightarrow
\mathbf{P}(\mathcal{O}_S^{\oplus n}) = \mathbf{P}^{n - 1}_S
$$
as desired. In general, let $\mathcal{L}$ be an ample invertible sheaf on $S$.
By Properties, Proposition \ref{properties-proposition-characterize-ample}
there exists an integer $n$ such that
$\mathcal{E} \otimes_{\mathcal{O}_S} \mathcal{L}^{\otimes n}$
is globally generated by finitely many sections. Since
$\mathbf{P}(\mathcal{E}) =
\mathbf{P}(\mathcal{E} \otimes_{\mathcal{O}_S} \mathcal{L}^{\otimes n})$ by
Constructions, Lemma \ref{constructions-lemma-twisting-and-proj}
this finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-proper-ample-is-proj}
Let $f : X \to S$ be a universally closed morphism.
Let $\mathcal{L}$ be an $f$-ample invertible $\mathcal{O}_X$-module.
Then the canonical morphism
$$
r : X
\longrightarrow
\underline{\text{Proj}}_S
\left(
\bigoplus\nolimits_{d \geq 0} f_*\mathcal{L}^{\otimes d}
\right)
$$
of Lemma \ref{lemma-characterize-relatively-ample} is an isomorphism.
\end{lemma}

\begin{proof}
Observe that $f$ is quasi-compact because the existence
of an $f$-ample invertible module forces $f$ to be quasi-compact.
By the lemma cited the morphism $r$ is an open immersion.
On the other hand, the image of $r$ is closed by
Lemma \ref{lemma-image-proper-scheme-closed}
(the target of $r$ is separated over $S$ by Constructions,
Lemma \ref{constructions-lemma-relative-proj-separated}).
Finally, the image of $r$ is dense by
Properties, Lemma \ref{properties-lemma-ample-immersion-into-proj}
(here we also use that it was shown in the proof of
Lemma \ref{lemma-characterize-relatively-ample}
that the morphism $r$ over affine opens of $S$
is given by the canonical morphism of
Properties, Lemma \ref{properties-lemma-map-into-proj}).
Thus we conclude that $r$ is a surjective open immersion, i.e.,
an isomorphism.
\end{proof}

\begin{lemma}
\label{lemma-proper-ample-delete-affine}
Let $f : X \to S$ be a universally closed morphism. Let $\mathcal{L}$
be an $f$-ample invertible $\mathcal{O}_X$-module. Let
$s \in \Gamma(X, \mathcal{L})$. Then $X_s \to S$ is an affine morphism.
\end{lemma}

\begin{proof}
The question is local on $S$ (Lemma \ref{lemma-characterize-affine})
hence we may assume $S$ is affine. By Lemma \ref{lemma-proper-ample-is-proj}
we can write $X = \text{Proj}(A)$ where $A$ is a graded
ring and $s$ corresponds to $f \in A_1$ and
$X_s = D_+(f)$ (Properties, Lemma \ref{properties-lemma-map-into-proj})
which proves the lemma by construction of $\text{Proj}(A)$, see
Constructions, Section \ref{constructions-section-proj}.
\end{proof}











\section{Integral and finite morphisms}
\label{section-integral}

\noindent
Recall that a ring map $R \to A$ is said to be {\it integral}
if every element of $A$ satisfies a monic equation with
coefficients in $R$. Recall that a ring map $R \to A$ is
said to be {\it finite} if $A$ is finite as an $R$-module.
See Algebra, Definition \ref{algebra-definition-integral-ring-map}.

\begin{definition}
\label{definition-integral}
Let $f : X \to S$ be a morphism of schemes.
\begin{enumerate}
\item We say that $f$ is {\it integral} if $f$ is affine
and if for every affine open $\Spec(R) = V \subset S$
with inverse image $\Spec(A) = f^{-1}(V) \subset X$
the associated ring map $R \to A$ is integral.
\item We say that $f$ is {\it finite} if $f$ is affine
and if for every affine open $\Spec(R) = V \subset S$
with inverse image $\Spec(A) = f^{-1}(V) \subset X$
the associated ring map $R \to A$ is finite.
\end{enumerate}
\end{definition}

\noindent
It is clear that integral/finite morphisms are separated and
quasi-compact. It is also clear that a finite morphism is a
morphism of finite type. Most of the lemmas in this section are
completely standard.
But note the fun Lemma \ref{lemma-integral-universally-closed}
at the end of the section.

\begin{lemma}
\label{lemma-integral-local}
Let $f : X \to S$ be a morphism of schemes.
The following are equivalent:
\begin{enumerate}
\item The morphism $f$ is integral.
\item There exists an affine open covering $S = \bigcup U_i$ such that
each $f^{-1}(U_i)$ is affine and
$\mathcal{O}_S(U_i) \to \mathcal{O}_X(f^{-1}(U_i))$ is integral.
\item There exists an open covering $S = \bigcup U_i$
such that each $f^{-1}(U_i) \to U_i$ is integral.
\end{enumerate}
Moreover, if $f$ is integral then for every open subscheme
$U \subset S$ the morphism $f : f^{-1}(U) \to U$ is integral.
\end{lemma}

\begin{proof}
See Algebra, Lemma \ref{algebra-lemma-integral-local}.
Some details omitted.
\end{proof}

\begin{lemma}
\label{lemma-finite-local}
Let $f : X \to S$ be a morphism of schemes.
The following are equivalent:
\begin{enumerate}
\item The morphism $f$ is finite.
\item There exists an affine open covering $S = \bigcup U_i$ such that
each $f^{-1}(U_i)$ is affine and
$\mathcal{O}_S(U_i) \to \mathcal{O}_X(f^{-1}(U_i))$ is finite.
\item There exists an open covering $S = \bigcup U_i$
such that each $f^{-1}(U_i) \to U_i$ is finite.
\end{enumerate}
Moreover, if $f$ is finite then for every open subscheme
$U \subset S$ the morphism $f : f^{-1}(U) \to U$ is finite.
\end{lemma}

\begin{proof}
See Algebra, Lemma \ref{algebra-lemma-integral-local}.
Some details omitted.
\end{proof}

\begin{lemma}
\label{lemma-finite-integral}
A finite morphism is integral.
An integral morphism which is locally of finite type is finite.
\end{lemma}

\begin{proof}
See Algebra, Lemma \ref{algebra-lemma-finite-is-integral}
and Lemma \ref{algebra-lemma-characterize-finite-in-terms-of-integral}.
\end{proof}

\begin{lemma}
\label{lemma-composition-finite}
A composition of finite morphisms is finite.
Same is true for integral morphisms.
\end{lemma}

\begin{proof}
See Algebra, Lemmas \ref{algebra-lemma-finite-transitive}
and \ref{algebra-lemma-integral-transitive}.
\end{proof}

\begin{lemma}
\label{lemma-base-change-finite}
A base change of a finite morphism is finite.
Same is true for integral morphisms.
\end{lemma}

\begin{proof}
See Algebra, Lemma \ref{algebra-lemma-base-change-integral}.
\end{proof}

\begin{lemma}
\label{lemma-integral-universally-closed}
\begin{slogan}
integral $=$ affine $+$ universally closed
\end{slogan}
Let $f : X \to S$ be a morphism of schemes.
The following are equivalent
\begin{enumerate}
\item $f$ is integral, and
\item $f$ is affine and universally closed.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume (1). An integral morphism is affine by definition.
A base change of an integral morphism is integral so in order to prove (2)
it suffices to show that an integral morphism is closed.
This follows from Algebra, Lemmas \ref{algebra-lemma-integral-going-up}
and \ref{algebra-lemma-going-up-closed}.

\medskip\noindent
Assume (2). We may assume $f$ is the morphism
$f : \Spec(A) \to \Spec(R)$ coming from a ring map
$R \to A$. Let $a$ be an element of $A$. We have to show
that $a$ is integral over $R$, i.e. that in the kernel
$I$ of the map $R[x] \to A$ sending $x$ to $a$ there is
a monic polynomial. Consider the ring
$B = A[x]/(ax -1)$ and let $J$ be the kernel of the
composition $R[x]\to A[x] \to B$. If $f\in J$ there exists
$q\in A[x]$ such that $f = (ax-1)q$ in $A[x]$ so if
$f = \sum_i f_ix^i$ and $q = \sum_iq_ix^i$, for all $i \geq 0$
we have $f_i = aq_{i-1} - q_i$. For $n \geq \deg q + 1$ the polynomial
$$
\sum\nolimits_{i \geq 0} f_i x^{n - i} =
\sum\nolimits_{i \geq 0} (a q_{i - 1} - q_i) x^{n - i} =
(a - x) \sum\nolimits_{i \geq 0} q_i x^{n - i - 1}
$$
is clearly in $I$; if $f_0 = 1$ this polynomial is also monic, so we
are reduced to prove that $J$ contains a polynomial with constant term $1$.
We do it by proving $\Spec(R[x]/(J + (x))$ is empty.


\medskip\noindent
Since $f$ is universally closed the base change $\Spec(A[x]) \to \Spec(R[x])$
is closed. Hence the image of the closed subset $\Spec(B) \subset \Spec(A[x])$
is the closed subset $\Spec(R[x]/J) \subset \Spec(R[x])$, see
Example \ref{example-scheme-theoretic-image} and
Lemma \ref{lemma-quasi-compact-scheme-theoretic-image}.
In particular $\Spec(B) \to \Spec(R[x]/J)$ is surjective. Consider the
following diagram where every square is a pullback:
$$
\xymatrix{
\Spec(B) \ar@{->>}[r]^g &
\Spec(R[x]/J)  \ar[r] &
\Spec(R[x])\\
\emptyset \ar[u] \ar[r] &
\Spec(R[x]/(J + (x)))\ar[u] \ar[r] &
\Spec(R) \ar[u]^0
}
$$
The bottom left corner is empty because it is the spectrum of
$R\otimes_{R[x]} B$ where the map $R[x]\to B$ sends $x$ to an
invertible element and $R[x]\to R$ sends $x$ to $0$. Since $g$
is surjective this implies $\Spec(R[x]/(J + (x)))$ is empty, as
we wanted to show.
\end{proof}

\begin{lemma}
\label{lemma-integral-fibres}
Let $f : X \to S$ be an integral morphism.
Then every point of $X$ is closed in its fibre.
\end{lemma}

\begin{proof}
See Algebra, Lemma \ref{algebra-lemma-integral-no-inclusion}.
\end{proof}

\begin{lemma}
\label{lemma-integral-dimension}
Let $f : X \to Y$ be an integral morphism. Then $\dim(X) \leq \dim(Y)$.
If $f$ is surjective then $\dim(X) = \dim(Y)$.
\end{lemma}

\begin{proof}
Since the dimension of $X$ and $Y$ is the supremum of the dimensions
of the members of an affine open covering, we may assume $Y$ and $X$
are affine. The inequality follows from
Algebra, Lemma \ref{algebra-lemma-integral-dim-up}.
The equality then follows from
Algebra, Lemmas \ref{algebra-lemma-dimension-going-up}
and \ref{algebra-lemma-integral-going-up}.
\end{proof}

\begin{lemma}
\label{lemma-finite-quasi-finite}
A finite morphism is quasi-finite.
\end{lemma}

\begin{proof}
This is implied by Algebra, Lemma \ref{algebra-lemma-quasi-finite}
and Lemma \ref{lemma-quasi-finite-locally-quasi-compact}.
Alternatively, all points in fibres are closed points by
Lemma \ref{lemma-integral-fibres} (and the fact that a finite
morphism is integral) and use
Lemma \ref{lemma-quasi-finite-at-point-characterize} (3) to
see that $f$ is quasi-finite at $x$ for all $x \in X$.
\end{proof}

\begin{lemma}
\label{lemma-finite-proper}
Let $f : X \to S$ be a morphism of schemes. The following are equivalent
\begin{enumerate}
\item $f$ is finite, and
\item $f$ is affine and proper.
\end{enumerate}
\end{lemma}

\begin{proof}
This follows formally from
Lemma \ref{lemma-integral-universally-closed},
the fact that a finite morphism is integral and separated,
the fact that a proper morphism is the same thing as
a finite type, separated, universally closed morphism,
and the fact that an integral morphism of finite type is
finite (Lemma \ref{lemma-finite-integral}).
\end{proof}

\begin{lemma}
\label{lemma-closed-immersion-finite}
A closed immersion is finite (and a fortiori integral).
\end{lemma}

\begin{proof}
True because a closed immersion is affine
(Lemma \ref{lemma-closed-immersion-affine})
and a surjective ring map is finite and integral.
\end{proof}

\begin{lemma}
\label{lemma-finite-union-finite}
Let $X_i \to Y$, $i = 1, \ldots, n$ be finite morphisms of schemes.
Then $X_1 \amalg \ldots \amalg X_n \to Y$ is finite too.
\end{lemma}

\begin{proof}
Follows from the algebra fact that if $R \to A_i$, $i = 1, \ldots, n$
are finite ring maps, then $R \to A_1 \times \ldots \times A_n$ is finite too.
\end{proof}

\begin{lemma}
\label{lemma-finite-permanence}
Let $f : X \to Y$ and $g : Y \to Z$ be morphisms.
\begin{enumerate}
\item If $g \circ f$ is finite and $g$ separated then $f$ is finite.
\item If $g \circ f$ is integral and $g$ separated then $f$ is integral.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume $g \circ f$ is finite (resp.\ integral) and $g$ separated.
The base change $X \times_Z Y \to Y$ is finite (resp.\ integral) by
Lemma \ref{lemma-base-change-finite}.
The morphism $X \to X \times_Z Y$ is
a closed immersion as $Y \to Z$ is separated, see
Schemes, Lemma \ref{schemes-lemma-section-immersion}.
A closed immersion is finite (resp.\ integral),
see Lemma \ref{lemma-closed-immersion-finite}.
The composition of finite (resp.\ integral) morphisms is finite
(resp.\ integral),
see Lemma \ref{lemma-composition-finite}. Thus we win.
\end{proof}

\begin{lemma}
\label{lemma-finite-monomorphism-closed}
Let $f : X \to Y$ be a morphism of schemes.
If $f$ is finite and a monomorphism, then $f$ is a closed immersion.
\end{lemma}

\begin{proof}
This reduces to
Algebra, Lemma \ref{algebra-lemma-finite-epimorphism-surjective}.
\end{proof}

\begin{lemma}
\label{lemma-finite-projective}
A finite morphism is projective.
\end{lemma}

\begin{proof}
Let $f : X \to S$ be a finite morphism. Then $f_*\mathcal{O}_X$ is
a quasi-coherent $\mathcal{O}_S$-module
(Lemma \ref{lemma-affine-equivalence-algebras})
of finite type
(by our definition of finite morphisms and
Properties, Lemma \ref{properties-lemma-finite-type-module}).
We claim there is a closed immersion
$$
\sigma :
X
\longrightarrow
\mathbf{P}(f_*\mathcal{O}_X) =
\underline{\text{Proj}}_S(\text{Sym}^*_{\mathcal{O}_S}(f_*\mathcal{O}_X))
$$
over $S$, which finishes
the proof. Namely, we let $\sigma$ be the morphism which corresponds
(via Constructions, Lemma \ref{constructions-lemma-apply-relative})
to the surjection
$$
f^*f_*\mathcal{O}_X \longrightarrow \mathcal{O}_X
$$
coming from the adjunction map $f^*f_* \to \text{id}$. Then $\sigma$
is a closed immersion. Namely, affine locally on $S$ we can write
$X = \Spec(A)$ and $S = \Spec(R)$. Since $X$ is finite over $S$
we may choose $a_1, \ldots, a_n \in A$ generating $A$ as an $R$-module.
Then the $R$-algebra map $R[T_0, T_1, \ldots, T_n] \to \text{Sym}_R^*(A)$
sending $T_0$ to $1$ and $T_i$ to $a_i$ for $1 \leq i \leq n$ is surjective.
Whence $\mathbf{P}(f_*\mathcal{O}_X)$ is a closed subscheme of
$\mathbf{P}^n_S$ by Constructions, Lemma
\ref{constructions-lemma-surjective-graded-rings-map-proj}.
Thus it suffices to prove that the induced morphism
$X \to \mathbf{P}^n_S$ is a closed immersion
(see for example, Lemma \ref{lemma-closed-immersion-ideals}).
The reader checks that $X \to \mathbf{P}^n_S$ has image contained
in the open $D_+(T_0) \cong \mathbf{A}^n_S$ and that $X \to \mathbf{A}^n_S$
corresponds to the surjective $R$-algebra map
$R[x_1, \ldots, x_n] \to \text{Sym}_R^*(A)$ sending $x_i$ to $a_i$.
Whence $X \to \mathbf{P}^n_S$ is an immersion (as a composition
of a closed immersion and an open immersion). Since
$X$ is finite over $S$ the image of this immersion is closed
(this uses Lemma \ref{lemma-finite-proper},
Lemma \ref{lemma-image-proper-scheme-closed}, and
Constructions, Lemma \ref{constructions-lemma-projective-space-separated}).
We conclude by Schemes, Lemma \ref{schemes-lemma-immersion-when-closed}.
\end{proof}







\section{Universal homeomorphisms}
\label{section-universal-homeomorphisms}

\noindent
The following definition is really superfluous since a universal
homeomorphism is really just an integral, universally injective
and surjective morphism, see
Lemma \ref{lemma-universal-homeomorphism}.

\begin{definition}
\label{definition-universal-homeomorphism}
A morphism $f : X \to Y$ of schemes is called a {\it universal homeomorphism}
if the base change $f' : Y' \times_Y X \to Y'$ is a homeomorphism for
every morphism $Y' \to Y$.
\end{definition}

\noindent
First we state the obligatory lemmas.

\begin{lemma}
\label{lemma-base-change-universal-homeomorphism}
The base change of a universal homeomorphism of schemes
by any morphism of schemes is a universal homeomorphism.
\end{lemma}

\begin{proof}
This is immediate from the definition.
\end{proof}

\begin{lemma}
\label{lemma-composition-universal-homeomorphism}
The composition of a pair of universal homeomorphisms of
schemes is a universal homeomorphism.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\noindent
The following simple lemma is the key to characterizing universal
homeomorphisms.

\begin{lemma}
\label{lemma-homeomorphism-affine}
Let $f : X \to Y$ be a morphism of schemes. If $f$ is a homeomorphism
onto a closed subset of $Y$ then $f$ is affine.
\end{lemma}

\begin{proof}
Let $y \in Y$ be a point. If $y \not \in f(X)$, then there exists
an affine neighbourhood of $y$ which is disjoint from $f(X)$.
If $y \in f(X)$, let $x \in X$ be the unique point of $X$ mapping to $y$.
Let $y \in V$ be an affine open neighbourhood.
Let $U \subset X$ be an affine open neighbourhood of $x$ which maps into $V$.
Since $f(U) \subset V \cap f(X)$ is open in the induced topology by our
assumption on $f$ we may choose a
$h \in \Gamma(V, \mathcal{O}_Y)$ such that $y \in D(h)$
and $D(h) \cap f(X) \subset f(U)$. Denote $h' \in \Gamma(U, \mathcal{O}_X)$
the restriction of $f^\sharp(h)$ to $U$. Then we see that
$D(h') \subset U$ is equal to $f^{-1}(D(h))$. In other words, every point
of $Y$ has an open neighbourhood whose inverse image is affine.
Thus $f$ is affine, see
Lemma \ref{lemma-characterize-affine}.
\end{proof}

\begin{lemma}
\label{lemma-universal-homeomorphism}
Let $f : X \to Y$ be a morphism of schemes. The following are
equivalent:
\begin{enumerate}
\item $f$ is a universal homeomorphism, and
\item $f$ is integral, universally injective and surjective.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume $f$ is a universal homeomorphism. By
Lemma \ref{lemma-homeomorphism-affine}
we see that $f$ is affine. Since $f$ is clearly universally closed we
see that $f$ is integral by
Lemma \ref{lemma-integral-universally-closed}.
It is also clear that $f$ is universally injective and surjective.

\medskip\noindent
Assume $f$ is integral, universally injective and surjective. By
Lemma \ref{lemma-integral-universally-closed}
$f$ is universally closed. Since it is also universally bijective (see
Lemma \ref{lemma-base-change-surjective})
we see that it is a universal homeomorphism.
\end{proof}

\begin{lemma}
\label{lemma-reduction-universal-homeomorphism}
Let $X$ be a scheme. The canonical closed immersion $X_{red} \to X$ (see
Schemes, Definition \ref{schemes-definition-reduced-induced-scheme})
is a universal homeomorphism.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-check-closed-infinitesimally}
Let $f : X \to S$ and $S' \to S$ be morphisms of schemes.
Assume
\begin{enumerate}
\item $S' \to S$ is a closed immersion,
\item $S' \to S$ is bijective on points,
\item $X \times_S S' \to S'$ is a closed immersion, and
\item $X \to S$ is of finite type or $S' \to S$ is of finite presentation.
\end{enumerate}
Then $f : X \to S$ is a closed immersion.
\end{lemma}

\begin{proof}
Assumptions (1) and (2) imply that $S' \to S$ is a universal homeomorphism
(for example because $S_{red} = S'_{red}$ and using
Lemma \ref{lemma-reduction-universal-homeomorphism}).
Hence (3) implies that $X \to S$ is homeomorphism onto a
closed subset of $S$. Then $X \to S$ is affine by
Lemma \ref{lemma-homeomorphism-affine}.
Let $U \subset S$ be an affine open, say $U = \Spec(A)$. Then $S' = \Spec(A/I)$
by (1) for a locally nilpotent ideal $I$ by (2). As $f$ is affine we see that
$f^{-1}(U) = \Spec(B)$.
Assumption (4) tells us $B$ is a finite type $A$-algebra
(Lemma \ref{lemma-locally-finite-type-characterize}) or
that $I$ is finitely generated
(Lemma \ref{lemma-closed-immersion-finite-presentation}).
Assumption (3) is that $A/I \to B/IB$ is surjective. From
Algebra, Lemma \ref{algebra-lemma-surjective-mod-locally-nilpotent}
if $A \to B$ is of finite type
or Algebra, Lemma \ref{algebra-lemma-NAK} if $I$ is finitely generated
and hence nilpotent we deduce that $A \to B$ is surjective.
This means that $f$ is a closed immersion, see
Lemma \ref{lemma-closed-immersion}.
\end{proof}

\begin{lemma}
\label{lemma-permanence-universal-homeomorphism}
Let $f : X \to Z$ be the composition of two morphisms 
$g : X \to Y$ and $h : Y \to Z$.
If two of the morphisms $\{f, g, h\}$ are universal homeomorphisms,
so is the third morphism.
\end{lemma}

\begin{proof}
If both of $g$ and $h$ are universal homeomorphisms, so is $f$ by
Lemma \ref{lemma-composition-universal-homeomorphism}.

\medskip\noindent
Suppose both of $f$ and $g$ are universal homeomorphisms. We want to show
that $h$ is also. Now base change the diagram along an arbitrary morphism
$\alpha : Z' \to Z$ of schemes,  we get the following diagram with all
squares Cartesian:
$$
\xymatrix{
X' \ar[r]^{g'} \ar[d] & Y' \ar[r]^{h'} \ar[d] & Z' \ar[d] \\
X \ar[r]^{g} & Y \ar[r]^{h} & Z.
}
$$
Our assumption implies that the composition $f'= h' \circ g' : X' \to Z'$
and $g' : X' \to Y'$ are homeomorphisms, therefore so is $h'$.
This finishes the proof of $h$ being a universal homeomorphism.

\medskip\noindent
Finally, assume $f$ and $h$ are universal
homeomorphisms. We want to show that $g$ is a universal homeomorphism.
Let $\beta : Y' \to Y$ be an arbitrary morphism of schemes.
We get the following diagram with all squares Cartesian:
$$
\xymatrix{
X' \ar[r]^{g'} \ar[d] & Y' \ar[d]^{\gamma} & \\
X'' \ar[r]^{g''} \ar[d] & Y'' \ar[r]^{h''} \ar[d] & Y' \ar[d]^{h \circ \beta} \\
X \ar[r]^{g} & Y \ar[r]^{h} & Z.
}
$$
Here the morphism $\gamma : Y' \to Y''$ is defined by the universal property of
fiber products and the two morphisms
$id_{Y'} : Y' \to Y'$ and $\beta : Y' \to Y$.
We shall prove that $g'$ is a homeomorphism.
Since the property of being a homeomorphism has 2-out-of-3 property, we see
that $g''$ is a homeomorphism.
Staring at the top square, it suffices to prove that $\gamma$ is a universal
homeomorphism. Since $h''$ is a homeomorphism, we see that it is
an affine morphism by Lemma \ref{lemma-homeomorphism-affine}
and a fortiori separated (Lemma \ref{lemma-affine-separated}).
Since $h'' \circ \gamma$ is the identity, we see that $\gamma$
is a closed immersion by
Schemes, Lemma \ref{schemes-lemma-section-immersion}.
Since $h''$ is bijective, it follows that $\gamma$ is a bijective
closed immersion and hence a universal homeomorphism (for example by the
characterization in Lemma \ref{lemma-universal-homeomorphism}) as desired.
\end{proof}




\section{Universal homeomorphisms of affine schemes}
\label{section-universal-homeomorphisms-affine}

\noindent
In this section we characterize universal homeomorphisms of affine schemes.

\begin{lemma}
\label{lemma-subalgebra-inherits}
Let $A \to B$ be a ring map such that the induced morphism of
schemes $f : \Spec(B) \to \Spec(A)$ is a universal homeomorphism,
resp.\ a universal homeomorphism inducing isomorphisms on residue fields,
resp.\ universally closed,
resp.\ universally closed and universally injective.
Then for any $A$-subalgebra $B' \subset B$
the same thing is true for $f' : \Spec(B') \to \Spec(A)$.
\end{lemma}

\begin{proof}
If $f$ is universally closed, then
$B$ is integral over $A$ by Lemma \ref{lemma-integral-universally-closed}.
Hence $B'$ is integral over $A$ and $f'$
is universally closed (by the same lemma).
This proves the case where $f$ is universally closed.

\medskip\noindent
Continuing, we see that $B$ is integral over $B'$ 
(Algebra, Lemma \ref{algebra-lemma-integral-permanence})
which implies $\Spec(B) \to \Spec(B')$ is surjective
(Algebra, Lemma \ref{algebra-lemma-integral-overring-surjective}).
Thus if $A \to B$ induces purely inseparable extensions of residue fields,
then the same is true for $A \to B'$. This proves the case
where $f$ is universally closed and universally injective, see
Lemma \ref{lemma-universally-injective}.

\medskip\noindent
The case where $f$ is a universal homeomorphism follows from
the remarks above, Lemma \ref{lemma-universal-homeomorphism},
and the obvious observation that if $f$ is surjective, then so is $f'$.

\medskip\noindent
If $A \to B$ induces isomorphisms on residue fields, then
so does $A \to B'$ (see argument in second paragraph).
In this way we see that the lemma holds in the remaining case.
\end{proof}

\begin{lemma}
\label{lemma-colimit-inherits}
Let $A$ be a ring. Let $B = \colim B_\lambda$ be a filtered colimit
of $A$-algebras. If each $f_\lambda : \Spec(B_\lambda) \to \Spec(A)$
is a universal homeomorphism,
resp.\ a universal homeomorphism inducing isomorphisms on residue fields,
resp.\ universally closed,
resp.\ universally closed and universally injective,
then the same thing is true for $f : \Spec(B) \to \Spec(A)$.
\end{lemma}

\begin{proof}
If $f_\lambda$ is universally closed, then
$B_\lambda$ is integral over $A$ by
Lemma \ref{lemma-integral-universally-closed}.
Hence $B$ is integral over $A$ and $f$
is universally closed (by the same lemma).
This proves the case where each $f_\lambda$ is universally closed.

\medskip\noindent
For a prime $\mathfrak q \subset B$ lying over $\mathfrak p \subset A$
denote $\mathfrak q_\lambda \subset B_\lambda$ the inverse image.
Then $\kappa(\mathfrak q) = \colim \kappa(\mathfrak q_\lambda)$.
Thus if $A \to B_\lambda$ induces purely inseparable extensions
of residue fields, then the same is true for $A \to B$. This proves the case
where $f_\lambda$ is universally closed and universally injective, see
Lemma \ref{lemma-universally-injective}.

\medskip\noindent
The case where $f$ is a universal homeomorphism follows from
the remarks above and Lemma \ref{lemma-universal-homeomorphism}
combined with the fact that prime ideals in $B$ are the same thing
as compatible sequences of prime ideals in all of the $B_\lambda$.

\medskip\noindent
If $A \to B_\lambda$ induces isomorphisms on residue fields, then
so does $A \to B$ (see argument in second paragraph).
In this way we see that the lemma holds in the remaining case.
\end{proof}

\begin{lemma}
\label{lemma-special-elements-and-localization}
Let $A \subset B$ be a ring extension. Let $S \subset A$ be a
multiplicative subset. Let $n \geq 1$ and
$b_i \in B$ for $1 \leq i \leq n$. Any $x \in S^{-1}B$ such that
$$
x \not \in S^{-1}A\text{ and } b_i x^i \in S^{-1}A\text{ for }i = 1, \ldots, n
$$
is equal to $s^{-1}y$ with $s \in S$ and $y \in B$ such that
$$
y \not \in A\text{ and } b_i y^i \in A\text{ for }i = 1, \ldots, n
$$
\end{lemma}

\begin{proof}
Omitted. Hint: clear denominators.
\end{proof}

\begin{lemma}
\label{lemma-nth-and-nplusone-implies-square-and-cube}
Let $A \subset B$ be a ring extension. If there exists
$b \in B$, $b \not \in A$ and an integer $n \geq 2$ with
$b^n \in A$ and $b^{n + 1} \in A$, then there exists a
$b' \in B$, $b' \not \in A$
with $(b')^2 \in A$ and $(b')^3 \in A$.
\end{lemma}

\begin{proof}
Let $b$ and $n$ be as in the lemma.
Then all sufficiently large powers of $b$ are in $A$.
Namely, $(b^n)^k(b^{n + 1})^i = b^{(k + i)n + i}$
which implies any power $b^m$ with $m \geq n^2$ is in $A$.
Hence if $i \geq 1$ is the largest integer such that
$b^i \not \in A$, then $(b^i)^2 \in A$ and $(b^i)^3 \in A$.
\end{proof}

\begin{lemma}
\label{lemma-square-and-cube}
Let $A \subset B$ be a ring extension such that $\Spec(B) \to \Spec(A)$
is a universal homeomorphism inducing isomorphisms on residue fields.
If $A \not = B$, then there exists a $b \in B$, $b \not \in A$ with
$b^2 \in A$ and $b^3 \in A$.
\end{lemma}

\begin{proof}
Recall that $A \subset B$ is integral
(Lemma \ref{lemma-integral-universally-closed}).
By Lemma \ref{lemma-subalgebra-inherits}
we may assume that $B$ is generated by a single element
over $A$. Hence $B$ is finite over $A$
(Algebra, Lemma \ref{algebra-lemma-characterize-finite-in-terms-of-integral}).
Hence the support of $B/A$ as an $A$-module is
closed and not empty (Algebra, Lemmas
\ref{algebra-lemma-support-closed} and \ref{algebra-lemma-support-zero}).
Let $\mathfrak p \subset A$ be a minimal prime
of the support. After replacing $A \subset B$ by
$A_\mathfrak p \subset B_\mathfrak p$ (permissible by
Lemma \ref{lemma-special-elements-and-localization})
we may assume that $(A, \mathfrak m)$ is a local ring,
that $B$ is finite over $A$, and that $B/A$ has support $\{\mathfrak m\}$
as an $A$-module. Since $B/A$ is a finite module,
we see that $I = \text{Ann}_A(B/A)$ satisfies $\mathfrak m = \sqrt{I}$
(Algebra, Lemma \ref{algebra-lemma-support-closed}).
Let $\mathfrak m' \subset B$ be the unique prime ideal lying over
$\mathfrak m$. Because $\Spec(B) \to \Spec(A)$ is a homeomorphism,
we find that $\mathfrak m' = \sqrt{IB}$.
For $f \in \mathfrak m'$ pick $n \geq 1$ such that
$f^n \in IB$. Then also $f^{n + 1} \in IB$.
Since $IB \subset A$ by our choice of $I$ we conclude that
$f^n, f^{n + 1} \in A$. Using
Lemma \ref{lemma-nth-and-nplusone-implies-square-and-cube}
we conclude our lemma is true if $\mathfrak m' \not \subset A$.
However, if $\mathfrak m' \subset A$, then $\mathfrak m' = \mathfrak m$
and we conclude that $A = B$ as the residue fields
are isomorphic as well by assumption. This contradiction
finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-pth-power-and-multiple}
Let $A \subset B$ be a ring extension such that $\Spec(B) \to \Spec(A)$
is a universal homeomorphism.
If $A \not = B$, then either there exists a $b \in B$, $b \not \in A$ with
$b^2 \in A$ and $b^3 \in A$ or there exists a prime number $p$
and a $b \in B$, $b \not \in A$ with $pb \in A$ and $b^p \in A$.
\end{lemma}

\begin{proof}
The argument is almost exactly the same as in the proof of
Lemma \ref{lemma-square-and-cube} but we write everything
out to make sure it works.

\medskip\noindent
Recall that $A \subset B$ is integral
(Lemma \ref{lemma-integral-universally-closed}).
By Lemma \ref{lemma-subalgebra-inherits}
we may assume that $B$ is generated by a single element
over $A$. Hence $B$ is finite over $A$
(Algebra, Lemma \ref{algebra-lemma-characterize-finite-in-terms-of-integral}).
Hence the support of $B/A$ as an $A$-module is
closed and not empty (Algebra, Lemmas
\ref{algebra-lemma-support-closed} and \ref{algebra-lemma-support-zero}).
Let $\mathfrak p \subset A$ be a minimal prime
of the support. After replacing $A \subset B$ by
$A_\mathfrak p \subset B_\mathfrak p$ (permissible by
Lemma \ref{lemma-special-elements-and-localization})
we may assume that $(A, \mathfrak m)$ is a local ring,
that $B$ is finite over $A$, and that $B/A$ has support $\{\mathfrak m\}$
as an $A$-module. Since $B/A$ is a finite module,
we see that $I = \text{Ann}_A(B/A)$ satisfies $\mathfrak m = \sqrt{I}$
(Algebra, Lemma \ref{algebra-lemma-support-closed}).
Let $\mathfrak m' \subset B$ be the unique prime ideal lying over
$\mathfrak m$. Because $\Spec(B) \to \Spec(A)$ is a homeomorphism,
we find that $\mathfrak m' = \sqrt{IB}$.
For $f \in \mathfrak m'$ pick $n \geq 1$ such that
$f^n \in IB$. Then also $f^{n + 1} \in IB$.
Since $IB \subset A$ by our choice of $I$ we conclude that
$f^n, f^{n + 1} \in A$. Using
Lemma \ref{lemma-nth-and-nplusone-implies-square-and-cube}
we conclude our lemma is true if $\mathfrak m' \not \subset A$.
If $\mathfrak m' \subset A$, then $\mathfrak m' = \mathfrak m$.
Since $A \not = B$ we conclude the map
$\kappa = A/\mathfrak m \to B/\mathfrak m' = \kappa'$
of residue fields cannot be an isomorphism. By
Lemma \ref{lemma-universally-injective} we conclude
that the characteristic of $\kappa$ is a prime number $p$
and that the extension $\kappa'/\kappa$ is purely inseparable.
Pick $b \in B$ whose image in $\kappa'$ is an element
not contained in $\kappa$ but whose $p$th power is in $\kappa$.
Then $b \not \in A$, $b^p \in A$, and $pb \in A$
(because $pb \in \mathfrak m' = \mathfrak m \subset A$)
as desired.
\end{proof}

\begin{proposition}
\label{proposition-universal-homeomorphism-equal-residue-fields}
Let $A \subset B$ be a ring extension. The following are equivalent
\begin{enumerate}
\item $\Spec(B) \to \Spec(A)$ is a universal homeomorphism inducing
isomorphisms on residue fields, and
\item every finite subset $E \subset B$ is contained in an extension
$$
A[b_1, \ldots, b_n] \subset B
$$
such that $b_i^2, b_i^3 \in A[b_1, \ldots, b_{i - 1}]$ for $i = 1, \ldots, n$.
\end{enumerate}
\end{proposition}

\begin{proof}
Assume (1). Using transfinite recursion we construct for each ordinal $\alpha$
an $A$-subalgebra $B_\alpha \subset B$ as follows. Set $B_0 = A$. If $\alpha$
is a limit ordinal, then we set $B_\alpha = \colim_{\beta < \alpha} B_\beta$.
If $\alpha = \beta + 1$, then either
$B_\beta = B$ in which case we set $B_\alpha = B_\beta$ or
$B_\beta \not = B$, in which case we apply Lemma \ref{lemma-square-and-cube}
to choose a $b_\alpha \in B$, $b_\alpha \not \in B_\beta$ with
$b_\alpha^2, b_\alpha^3 \in B_\beta$
and we set $B_\alpha = B_\beta[b_\alpha] \subset B$.
Clearly, $B = \colim B_\alpha$ (in fact $B = B_\alpha$ for some
ordinal $\alpha$ as one sees by looking at cardinalities).
We will prove, by transfinite induction, that (2) holds for
$A \to B_\alpha$ for every ordinal $\alpha$. It is clear for
$\alpha = 0$. Assume the statement holds for every $\beta < \alpha$
and let $E \subset B_\alpha$ be a finite subset.
If $\alpha$ is a limit ordinal, then
$B_\alpha = \bigcup_{\beta < \alpha} B_\beta$ and we see
that $E \subset B_\beta$ for some $\beta < \alpha$ which
proves the result in this case. If $\alpha = \beta + 1$,
then $B_\alpha = B_\beta[b_\alpha]$. Thus any $e \in E$
can be written as a polynomial $e = \sum d_{e, i}b_\alpha^i$
with $d_{e, i} \in B_\beta$. Let $D \subset B_\beta$
be the set $D = \{d_{e, i}\} \cup \{b_\alpha^2, b_\alpha^3\}$.
By induction assumption
there exists an $A$-subalgebra $A[b_1, \ldots, b_n] \subset B_\beta$
as in the statement of the lemma containing $D$.
Then $A[b_1, \ldots, b_n, b_\alpha] \subset B_\alpha$
is an $A$-subalgebra of $B_\alpha$ as in the statement
of the lemma containing $E$.

\medskip\noindent
Assume (2). Write $B = \colim B_\lambda$ as the colimit of its
finite $A$-subalgebras.
By Lemma \ref{lemma-colimit-inherits} it suffices to show
that $\Spec(B_\lambda) \to \Spec(A)$ is a
universal homeomorphism inducing isomorphisms on residue fields.
Compositions of universally closed morphisms are universally closed
and the same thing for morphisms which induce isomorphisms on residue fields.
Thus it suffices to show that if $A \subset B$ and $B$ is generated
by a single element $b$ with $b^2, b^3 \in A$, then (1) holds.
Such an extension is integral and hence $\Spec(B) \to \Spec(A)$ is
universally closed and surjective
(Lemma \ref{lemma-integral-universally-closed} and
Algebra, Lemma \ref{algebra-lemma-integral-overring-surjective}).
Note that $(b^2)^3 = (b^3)^2$ in $A$.
For any ring map $\varphi : A \to K$ to a field $K$ we see that there
exists a $\lambda \in K$ with $\varphi(b^2) = \lambda^2$ and
$\varphi(b^3) = \lambda^3$. Namely, $\lambda = 0$ if $\varphi(b^2) = 0$
and $\lambda = \varphi(b^3)/\varphi(b^2)$ if not. Thus
$B \otimes_A K$ is a quotient of $K[x]/(x^2 - \lambda^2, x^3 - \lambda^3)$.
This ring has exactly one prime with residue field $K$.
This implies that $\Spec(B) \to \Spec(A)$ is bijective and induces
isomorphisms on residue fields. Combined with universal closedness
this shows (1) is true, see Lemmas \ref{lemma-universal-homeomorphism}
and \ref{lemma-universally-injective}.
\end{proof}

\begin{proposition}
\label{proposition-universal-homeomorphism}
Let $A \subset B$ be a ring extension. The following are equivalent
\begin{enumerate}
\item $\Spec(B) \to \Spec(A)$ is a universal homeomorphism, and
\item every finite subset $E \subset B$ is contained in an extension
$$
A[b_1, \ldots, b_n] \subset B
$$
such that for $i = 1, \ldots, n$ we have
\begin{enumerate}
\item $b_i^2, b_i^3 \in A[b_1, \ldots, b_{i - 1}]$, or
\item there exists a prime number $p$ with
$pb_i, b_i^p \in A[b_1, \ldots, b_{i - 1}]$.
\end{enumerate}
\end{enumerate}
\end{proposition}

\begin{proof}
The proof is exactly the same as the proof of
Proposition \ref{proposition-universal-homeomorphism-equal-residue-fields}
except for the following changes:
\begin{enumerate}
\item Use Lemma \ref{lemma-pth-power-and-multiple} instead of
Lemma \ref{lemma-square-and-cube} which means that for each successor
ordinal $\alpha = \beta + 1$ we either have
$b_\alpha^2, b_\alpha^3 \in B_\beta$ or we have a prime $p$ and
$pb_\alpha, b_\alpha^p \in B_\beta$.
\item If $\alpha$ is a successor ordinal, then take
$D = \{d_{e, i}\} \cup \{b_\alpha^2, b_\alpha^3\}$ or
take $D = \{d_{e, i}\} \cup \{pb_\alpha, b_\alpha^p\}$ depending
on which case $\alpha$ falls into.
\item In the proof of (2) $\Rightarrow$ (1) we also need to consider
the case where $B$ is generated over $A$ by a single element $b$
with $pb, b^p \in B$ for some prime number $p$. Here $A \subset B$
induces a universal homeomorphism on spectra for example by
Algebra, Lemma \ref{algebra-lemma-p-ring-map}.
\end{enumerate}
This finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-universal-homeo-iso-if-invert-p}
Let $p$ be a prime number. Let $A \to B$ be a ring map
which induces an isomorphism $A[1/p] \to B[1/p]$
(for example if $p$ is nilpotent in $A$).
The following are equivalent
\begin{enumerate}
\item $\Spec(B) \to \Spec(A)$ is a universal homeomorphism, and
\item the kernel of $A \to B$ is a locally nilpotent ideal and
for every $b \in B$ there exists a $p$-power $q$ with $qb$ and $b^q$
in the image of $A \to B$.
\end{enumerate}
\end{lemma}

\begin{proof}
If (2) holds, then (1) holds by Algebra, Lemma \ref{algebra-lemma-p-ring-map}.
Assume (1). Then the kernel of $A \to B$ consists of nilpotent
elements by Algebra, Lemma \ref{algebra-lemma-image-dense-generic-points}.
Thus we may replace $A$ by the image of $A \to B$ and assume that
$A \subset B$. By Algebra, Lemma \ref{algebra-lemma-help-with-powers}
the set
$$
B' = \{b \in B \mid p^nb, b^{p^n} \in A\text{ for some }n \geq 0\}
$$
is an $A$-subalgebra of $B$ (being closed under products is trivial).
We have to show $B' = B$. If not, then
according to Lemma \ref{lemma-pth-power-and-multiple}
there exists a $b \in B$, $b \not \in B'$ with either
$b^2, b^3 \in B'$ or there exists a prime number $\ell$
with $\ell b, b^\ell \in B'$.
We will show both cases lead to a contradiction, thereby proving the lemma.

\medskip\noindent
Since $A[1/p] = B[1/p]$ we can choose a $p$-power $q$ such that $qb \in A$.

\medskip\noindent
If $b^2, b^3 \in B'$ then also $b^q \in B'$. By definition of $B'$
we find that $(b^q)^{q'} \in A$ for some $p$-power $q'$.
Then $qq'b, b^{qq'} \in A$ whence $b \in B'$ which is a contradiction.

\medskip\noindent
Assume now there exists a prime number $\ell$ with $\ell b, b^\ell \in B'$.
If $\ell \not = p$ then $\ell b \in B'$ and $qb \in A \subset B'$ imply
$b \in B'$ a contradiction. Thus $\ell = p$ and $b^p \in B'$
and we get a contradiction exactly as before.
\end{proof}

\begin{lemma}
\label{lemma-make-universal-homeo}
Let $A$ be a ring. Let $x, y \in A$.
\begin{enumerate}
\item If $x^3 = y^2$ in $A$, then $A \to B = A[t]/(t^2 - x, t^3 - y)$
induces bijections on residue fields and a
universal homeomorphism on spectra.
\item If there is a prime number $p$ such that $p^px = y^p$ in $A$, then
$A \to B = A[t]/(t^p - x, pt - y)$ induces a universal
homeomorphism on spectra.
\end{enumerate}
\end{lemma}

\begin{proof}
We will use the criterion of Lemma \ref{lemma-universal-homeomorphism}
to check this. In both cases the ring map is integral. Thus it suffices to show
that given a field $k$ and a ring map $\varphi : A \to k$
the $k$-algebra $B \otimes_A k$ has a unique prime ideal
whose residue field is equal to $k$ in case (1) and
purely inseparable over $k$ in case (2). See
Lemma \ref{lemma-universally-injective}.

\medskip\noindent
In case (1) set $\lambda = 0$ if $\varphi(x) = 0$ and set
$\lambda = \varphi(y)/\varphi(x)$ if not. Then
$B = k[t]/(t^2 - \lambda^2, t^3 - \lambda^2)$.
Thus the result is clear.

\medskip\noindent
In case (2) if the characteristic of $k$ is $p$, then
we obtain $\varphi(y) = 0$ and $B = k[t]/(t^p - \varphi(x))$
which is a local Artinian $k$-algebra whose residue field
is either $k$ or a degree $p$ purely inseparable extension of $k$.
If the characteristic of $k$ is not $p$, then setting
$\lambda = \varphi(y)/p$ we see $B = k[t]/(t - \lambda) = k$
and we conclude as well.
\end{proof}

\begin{lemma}
\label{lemma-universal-homeo-limit}
Let $A \to B$ be a ring map.
\begin{enumerate}
\item If $A \to B$ induces a universal homeomorphism on spectra,
then $B = \colim B_i$ is a filtered colimit of finitely presented $A$-algebras
$B_i$ such that $A \to B_i$ induces a universal homeomorphism on spectra.
\item If $A \to B$ induces isomorphisms on residue fields and
a universal homeomorphism on spectra, then $B = \colim B_i$ is a
filtered colimit of finitely presented $A$-algebras $B_i$ such that
$A \to B_i$ induces isomorphisms on residue fields and a
universal homeomorphism on spectra.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). We will use the criterion of
Algebra, Lemma \ref{algebra-lemma-when-colimit}.
Let $A \to C$ be of finite presentation and let $\varphi : C \to B$
be an $A$-algebra map. Let $B' = \varphi(C) \subset B$ be the image.
Then $A \to B'$ induces a universal homeomorphism on spectra by
Lemma \ref{lemma-subalgebra-inherits}.
By Algebra, Lemma \ref{algebra-lemma-ring-colimit-fp}
we can write $B' = \colim_{i \in I} B_i$
with $A \to B_i$ of finite presentation and surjective
transition maps.
By Algebra, Lemma \ref{algebra-lemma-characterize-finite-presentation}
we can choose an index $0 \in I$
and a factorization $C \to B_0 \to B'$ of the map $C \to B'$.
We claim that $\Spec(B_i) \to \Spec(A)$ is a universal homeomorphism
for $i$ sufficiently large. The claim finishes the proof of (1).

\medskip\noindent
Proof of the claim. By Lemma \ref{lemma-reduction-universal-homeomorphism}
the ring map $A_{red} \to B'_{red}$ induces a universal homeomorphism
on spectra. Thus $A_{red} \subset B'_{red}$ by
Algebra, Lemma \ref{algebra-lemma-image-dense-generic-points}.
Setting $A' = \Im(A \to B')$ we have surjections $A \to A' \to A_{red}$
inducing bijections $\Spec(A_{red}) = \Spec(A') = \Spec(A)$.
Thus $A' \subset B'$ induces a universal homeomorphism on spectra.
By Proposition \ref{proposition-universal-homeomorphism}
and the fact that $B'$ is finite type over $A'$ we can
find $n$ and $b'_1, \ldots, b'_n \in B'$ such that
$B' = A'[b'_1, \ldots, b'_n]$
and such that for $j = 1, \ldots, n$ we have
\begin{enumerate}
\item $(b'_j)^2, (b'_j)^3 \in A'[b'_1, \ldots, b'_{j - 1}]$, or
\item there exists a prime number $p$ with
$pb'_j, (b'_j)^p \in A'[b'_1, \ldots, b'_{j - 1}]$.
\end{enumerate}
Choose $b_1, \ldots, b_n \in B_0$ lifting $b'_1, \ldots, b'_n$.
For $i \geq 0$ denote $b_{j, i}$ the image of $b_j$ in $B_i$.
For large enough $i$ we will have for $j = 1, \ldots, n$
\begin{enumerate}
\item $b_{j, i}^2, b_{j, i}^3 \in A_i[b_{1, i}, \ldots, b_{j - 1, i}]$, or
\item there exists a prime number $p$ with
$pb_{j, i}, b_{j, i}^p \in A_i[b_{1, i}, \ldots, b_{j - 1, i}]$.
\end{enumerate}
Here $A_i \subset B_i$ is the image of $A \to B_i$. Observe that $A \to A_i$
is a surjective ring map whose kernel is a locally nilpotent ideal.
After increasing $i$ more if necessary, we may assume $B_i$
is generated by $b_1, \ldots, b_n$ over $A_i$, in other words
$B_i = A_i[b_1, \ldots, b_n]$.
By Algebra, Lemmas \ref{algebra-lemma-p-ring-map} and
\ref{algebra-lemma-2-3-ring-map} we conclude that
$A \to A_i \to A_i[b_1] \to \ldots \to A_i[b_1, \ldots, b_n] = B_i$
induce universal homeomorphisms on spectra. This finishes the proof
of the claim.

\medskip\noindent
The proof of (2) is exactly the same.
\end{proof}







\section{Absolute weak normalization and seminormalization}
\label{section-seminormalization}

\noindent
Motivated by the results proved in the previous section
we give the following definition.

\begin{definition}
\label{definition-seminormal-ring}
Let $A$ be a ring.
\begin{enumerate}
\item We say $A$ is {\it seminormal} if for all $x, y \in A$
with $x^3 = y^2$ there is a unique $a \in A$ with
$x = a^2$ and $y = a^3$.
\item We say $A$ is {\it absolutely weakly normal} if
(a) $A$ is seminormal and
(b) for any prime number $p$ and $x, y \in A$ with $p^px = y^p$
there is a unique $a \in A$ with $x = a^p$ and $y = pa$.
\end{enumerate}
\end{definition}

\noindent
An amusing observation, see \cite{Costa},
is that in the definition of seminormal rings it suffices\footnote{Let
$A$ be a ring such that for all $x, y \in A$ with $x^3 = y^2$ there is
an $a \in A$ with $x = a^2$ and $y = a^3$. Then $A$ is reduced: if
$x^2 = 0$, then $x^2 = x^3$ and hence there exists an $a$ such that
$x = a^3$ and $x = a^2$. Then $x = a^3 = ax = a^4 = x^2 = 0$. Finally,
if $a_1^2 = a_2^2$ and $a_1^3 = a_2^3$ for $a_1, a_2$ in a reduced ring,
then $(a_1 - a_2)^3 = a_1^3 - 3a_1^2a_2 +3a_1a_2^2 - a_2^3 =
(1 - 3 + 3 - 1)a_1^3 = 0$ and hence $a_1 = a_2$.} to assume the existence
of $a$. Absolutely weakly normal schemes were defined in
\cite[Appendix B]{rydh_descent}.

\begin{lemma}
\label{lemma-seminormal-local-property}
Being seminormal or being absolutely weakly normal
is a local property of rings, see
Properties, Definition \ref{properties-definition-property-local}.
\end{lemma}

\begin{proof}
Suppose that $A$ is seminormal and $f \in A$. Let $x', y' \in A_f$
with $(x')^3 = (y')^2$. Write $x' = x/f^{2n}$ and $y' = y/f^{3n}$
for some $n \geq 0$ and $x, y \in A$. After replacing $x, y$
by $f^{2m}x, f^{3m}y$ and $n$ by $n + m$, we see that
$x^3 = y^2$ in $A$. Then we find a unique $a \in A$ with
$x = a^2$ and $y = a^3$. Setting $a' = a/f^n$ we get
$x' = (a')^2$ and $y' = (a')^3$ as desired. Uniqueness
of $a'$ follows from uniqueness of $a$.
In exactly the same manner the reader shows that if $A$ is
absolutely weakly normal,
then $A_f$ is absolutely weakly normal.

\medskip\noindent
Assume $A$ is a ring and $f_1, \ldots, f_n \in A$ generate the unit
ideal. Assume $A_{f_i}$ is seminormal for each $i$.
Let $x, y \in A$ with $x^3 = y^2$. For each $i$ we find a unique
$a_i \in A_{f_i}$ with $x = a_i^2$ and $y = a_i^3$ in $A_{f_i}$.
By the uniqueness and the result of the first paragraph (which
tells us that $A_{f_if_j}$ is seminormal) we see that
$a_i$ and $a_j$ map to the same element of $A_{f_if_j}$.
By Algebra, Lemma \ref{algebra-lemma-standard-covering}
we find a unique $a \in A$
mapping to $a_i$ in $A_{f_i}$ for all $i$.
Then $x = a^2$ and $y = a^3$ by the same token. Clearly this $a$ is unique.
Thus $A$ is seminormal. If we assume $A_{f_i}$ is absolutely weakly normal,
then the exact same argument shows that $A$ is absolutely weakly normal.
\end{proof}

\noindent
Next we define seminormal schemes and absolutely weakly normal schemes.

\begin{definition}
\label{definition-seminormal}
Let $X$ be a scheme.
\begin{enumerate}
\item We say $X$ is {\it seminormal} if every $x \in X$ has
an affine open neighbourhood $\Spec(R) = U \subset X$
such that the ring $R$ is seminormal.
\item We say $X$ is {\it absolutely weakly normal} if every $x \in X$ has
an affine open neighbourhood $\Spec(R) = U \subset X$
such that the ring $R$ is absolutely weakly normal.
\end{enumerate}
\end{definition}

\noindent
Here is the obligatory lemma.

\begin{lemma}
\label{lemma-locally-seminormal}
Let $X$ be a scheme. The following are equivalent:
\begin{enumerate}
\item The scheme $X$ is seminormal.
\item For every affine open $U \subset X$ the ring $\mathcal{O}_X(U)$
is seminormal.
\item There exists an affine open covering $X = \bigcup U_i$ such that
each $\mathcal{O}_X(U_i)$ is seminormal.
\item There exists an open covering $X = \bigcup X_j$
such that each open subscheme $X_j$ is seminormal.
\end{enumerate}
Moreover, if $X$ is seminormal
then every open subscheme is seminormal.
The same statements are true with ``seminormal'' replaced by
``absolutely weakly normal''.
\end{lemma}

\begin{proof}
Combine Properties, Lemma \ref{properties-lemma-locally-P} and
Lemma \ref{lemma-seminormal-local-property}.
\end{proof}

\begin{lemma}
\label{lemma-seminormal-reduced}
A seminormal scheme or ring is reduced. A fortiori the same
is true for absolutely weakly normal schemes or rings.
\end{lemma}

\begin{proof}
Let $A$ be a ring.
If $a \in A$ is nonzero but $a^2 = 0$, then $a^2 = 0^2$ and
$a^3 = 0^3$ and hence $A$ is not seminormal.
\end{proof}

\begin{lemma}
\label{lemma-seminormalization-ring}
Let $A$ be a ring.
\begin{enumerate}
\item The category of ring maps $A \to B$ inducing a
universal homeomorphism on spectra has a final object $A \to A^{awn}$.
\item Given $A \to B$ in the category of (1) the resulting map
$B \to A^{awn}$ is an isomorphism if and only if $B$ is
absolutely weakly normal.
\item The category of ring maps $A \to B$ inducing isomorphisms on
residue fields and a universal homeomorphism on spectra has a final
object $A \to A^{sn}$.
\item Given $A \to B$ in the category of (3) the resulting map
$B \to A^{sn}$ is an isomorphism if and only if $B$ is seminormal.
\end{enumerate}
For any ring map $\varphi : A \to A'$ there are unique maps
$\varphi^{awn} : A^{awn} \to (A')^{awn}$ and
$\varphi^{sn} : A^{sn} \to (A')^{sn}$ compatible with $\varphi$.
\end{lemma}

\begin{proof}
We prove (1) and (2) and we omit the proof of (3) and (4) and
the final statement. Consider the category of $A$-algebras of the form
$$
B = A[x_1, \ldots, x_n]/J
$$
where $J$ is a finitely generated ideal such that $A \to B$ defines a
universal homeomorphism on spectra. We claim this category is directed
(Categories, Definition \ref{categories-definition-directed}). Namely, given
$$
B = A[x_1, \ldots, x_n]/J
\quad\text{and}\quad
B' = A[x_1, \ldots, x_{n'}]/J'
$$
then we can consider
$$
B'' = A[x_1, \ldots, x_{n + n'}]/J''
$$
where $J''$ is generated by the elements of $J$ and the elements
$f(x_{n + 1}, \ldots, x_{n + n'})$ where $f \in J'$.
Then we have $A$-algebra homomorphisms $B \to B''$ and $B' \to B''$
which induce an isomorphism $B \otimes_A B' \to B''$.
It follows from
Lemmas \ref{lemma-base-change-universal-homeomorphism} and
\ref{lemma-composition-universal-homeomorphism}
that $\Spec(B'') \to \Spec(A)$ is a universal homeomorphism and
hence $A \to B''$ is in our category.
Finally, given $\varphi, \varphi' : B \to B'$
in our category with $B$ as displayed above,
then we consider the quotient $B''$ of $B'$
by the ideal generated by $\varphi(x_i) - \varphi'(x_i)$, $i = 1, \ldots, n$.
Since $\Spec(B') = \Spec(B)$ we see that $\Spec(B'') \to \Spec(B')$
is a bijective closed immersion hence a universal homeomorphism.
Thus $B''$ is in our category and $\varphi, \varphi'$ are equalized
by $B' \to B''$. This completes the proof of our claim. We set
$$
A^{awn} = \colim B
$$
where the colimit is over the category just described. Observe that
$A \to A^{awn}$ induces a universal homeomorphism on spectra by
Lemma \ref{lemma-colimit-inherits} (this is where we use the category
is directed).

\medskip\noindent
Given a ring map $A \to B$ of finite presentation inducing a universal
homeomorphism on spectra, we get a canonical map $B \to A^{awn}$ by the
very construction of $A^{awn}$. Since every $A \to B$ as in (1)
is a filtered colimit of $A \to B$ as in (1) of finite presentation
(Lemma \ref{lemma-universal-homeo-limit}), we see that
$A \to A^{awn}$ is final in the category (1).

\medskip\noindent
Let $x, y \in A^{awn}$ be elements such that $x^3 = y^2$.
Then $A^{awn} \to A^{awn}[t]/(t^2 - x, t^3 - y)$ induces
a universal homeomorphism on spectra by Lemma \ref{lemma-make-universal-homeo}.
Thus $A \to A^{awn}[t]/(t^2 - x, t^3 - y)$ is in the category (1)
and we obtain a unique $A$-algebra map
$A^{awn}[t]/(t^2 - x, t^3 - y) \to A^{awn}$.
The image $a \in A^{awn}$ of $t$ is therefore the unique
element such that $a^2 = x$ and $a^3 = y$ in $A^{awn}$.
In exactly the same manner, given a prime $p$ and $x, y \in A^{awn}$
with $p^px = y^p$ we find a unique $a \in A^{awn}$ with
$a^p = x$ and $pq = y$. Thus $A^{awn}$ is absolutely weakly normal
by definition.

\medskip\noindent
Finally, let $A \to B$ be in the category (1) with $B$ absolutely weakly normal.
Since $A^{awn} \to B^{awn}$ induces a universal homeomorphism on spectra and 
since $A^{awn}$ is reduced (Lemma \ref{lemma-seminormal-reduced}) we find
$A^{awn} \subset B^{awn}$
(see Algebra, Lemma \ref{algebra-lemma-image-dense-generic-points}).
If this inclusion is not an equality, then
Lemma \ref{lemma-pth-power-and-multiple}
implies there is an element $b \in B^{awn}$, $b \not \in A^{awn}$
such that either $b^2, b^3 \in A^{awn}$ or $pb, b^p \in A^{awn}$
for some prime number $p$. However, by the existence and uniqueness in
Definition \ref{definition-seminormal-ring} this forces $b \in A^{awn}$
and hence we obtain the contradiction that finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-seminormalization}
Let $X$ be a scheme.
\begin{enumerate}
\item The category of universal homeomorphisms $Y \to X$ has
an initial object $X^{awn} \to X$.
\item Given $Y \to X$ in the category of (1) the resulting morphism
$X^{awn} \to Y$ is an isomorphism if and only if $Y$ is
absolutely weakly normal.
\item The category of universal homeomorphisms $Y \to X$ which
induce ismomorphisms on residue fields has an initial object
$X^{sn} \to X$.
\item Given $Y \to X$ in the category of (3) the resulting morphism
$X^{sn} \to Y$ is an isomorphism if and only if $Y$ is seminormal.
\end{enumerate}
For any morphism $h : X' \to X$ of schemes there are unique morphisms
$h^{awn} : (X')^{awn} \to X^{awn}$ and $h^{sn} : (X')^{sn} \to X^{sn}$
compatible with $h$.
\end{lemma}

\begin{proof}
We will prove (1) and (2) and omit the proof of (3) and (4).
Let $h : X' \to X$ be a morphism of schemes. If (1) holds for $X$
and $X'$, then $X' \times_X X^{awn} \to X'$ is a universal homeomorphism
and hence we get a unique morphism $(X')^{awn} \to X' \times_X X^{awn}$
over $X'$ by the universal property of $(X')^{awn} \to X'$. Composed with the
projection $X' \times_X X^{awn} \to X^{awn}$ we obtain $h^{awn}$.
If in addition (2) holds for $X$ and $X'$ and $h$ is an open immersion, then
$X' \times_X X^{awn}$ is absolutely weakly normal
(Lemma \ref{lemma-locally-seminormal}) and we deduce that
$(X')^{awn} \to X' \times_X X^{awn}$ is an isomorphism.

\medskip\noindent
Recall that any universal homeomorphism is affine, see
Lemma \ref{lemma-homeomorphism-affine}. Thus if $X$ is affine
then (1) and (2) follow immediately from
Lemma \ref{lemma-seminormalization-ring}.
Let $X$ be a scheme and let $\mathcal{B}$ be the set of affine opens
of $X$. For each $U \in \mathcal{B}$ we obtain $U^{awn} \to U$
and for $V \subset U$, $V, U \in \mathcal{B}$ we obtain a canonical
isomorphism $\rho_{V, U} : V^{awn} \to V \times_U U^{awn}$ by the discussion
in the previous paragraph. Thus by relative glueing
(Constructions, Lemma \ref{constructions-lemma-relative-glueing})
we obtain a morphism $X^{awn} \to X$ which restricts
to $U^{awn}$ over $U$ compatibly with the $\rho_{V, U}$.
Next, let $Y \to X$ be a universal homeomorphism.
Then $U \times_X Y \to U$ is a universal homeomorphism for $U \in \mathcal{B}$
and we obtain a unique morphism $g_U : U^{awn} \to U \times_X Y$ over $U$.
These $g_U$ are compatible with the morphisms $\rho_{V, U}$; details
omitted. Hence there is a unique morphism $g : X^{awn} \to Y$
over $X$ agreeing with $g_U$ over $U$, see
Constructions, Remark \ref{constructions-remark-relative-glueing-functorial}.
This proves (1) for $X$. Part (2) follows because it holds affine locally.
\end{proof}

\begin{definition}
\label{definition-seminormalization}
Let $X$ be a scheme.
\begin{enumerate}
\item The morphism $X^{sn} \to X$ constructed in
Lemma \ref{lemma-seminormalization}
is the {\it seminormalization} of $X$.
\item The morphism $X^{awn} \to X$ constructed in
Lemma \ref{lemma-seminormalization}
is the {\it absolute weak normalization} of $X$.
\end{enumerate}
\end{definition}

\noindent
To be sure, the seminormalization $X^{sn}$ of $X$ is a seminormal
scheme and the absolute weak normalization $X^{awn}$ is an
absolutely weakly normal scheme.
Moreover, for any morphism $h : Y \to X$ of schemes we obtain a
canonical commutative diagram
$$
\xymatrix{
Y^{awn} \ar[d]^{h^{awn}} \ar[r] &
Y^{sn} \ar[d]^{h^{sn}} \ar[r] &
Y \ar[d]^h \\
X^{awn} \ar[r] &
X^{sn} \ar[r] &
X
}
$$
of schemes; the arrows $h^{sn}$ and $h^{awn}$ are the unique
ones compatible with $h$.

\begin{lemma}
\label{lemma-characterize-seminormal}
Let $X$ be a scheme. The following are equivalent
\begin{enumerate}
\item $X$ is seminormal,
\item $X$ is equal to its own seminormalization, i.e., the morphism
$X^{sn} \to X$ is an isomorphism,
\item if $\pi : Y \to X$ is a universal homeomorphism inducing isomorphisms
on residue fields with $Y$ reduced, then $\pi$ is an isomorphism.
\end{enumerate}
\end{lemma}

\begin{proof}
The equivalence of (1) and (2) is clear from
Lemma \ref{lemma-seminormalization}. If (3) holds, then $X^{sn} \to X$
is an isomorphism and we see that (2) holds.

\medskip\noindent
Assume (2) holds and let $\pi : Y \to X$ be a universal homeomorphism
inducing isomorphisms on residue fields with $Y$ reduced. Then there exists
a factorization $X \to Y \to X$ of $\text{id}_X$ by
Lemma \ref{lemma-seminormalization}. Then $X \to Y$ is a closed immersion
(by Schemes, Lemma \ref{schemes-lemma-section-immersion}
and the fact that $\pi$ is separated for example by
Lemma \ref{lemma-universally-injective-separated}). Since $X \to Y$
is also a bijection on points, the reducedness of $Y$ shows that it
has to be an isomorphism. This finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-characterize-absolutely-weakly-normal}
Let $X$ be a scheme. The following are equivalent
\begin{enumerate}
\item $X$ is absolutely weakly normal,
\item $X$ is equal to its own absolute weak normalization, i.e., the morphism
$X^{awn} \to X$ is an isomorphism,
\item if $\pi : Y \to X$ is a universal homeomorphism with $Y$ reduced, then
$\pi$ is an isomorphism.
\end{enumerate}
\end{lemma}

\begin{proof}
This is proved in exactly the same manner as
Lemma \ref{lemma-characterize-seminormal}.
\end{proof}





\section{Finite locally free morphisms}
\label{section-finite-locally-free}

\noindent
In many papers the authors use finite flat morphisms when they really mean
finite locally free morphisms. The reason is that if the base is locally
Noetherian then this is the same thing. But in general it is not, see
Exercises, Exercise \ref{exercises-exercise-flat-not-projective}.

\begin{definition}
\label{definition-finite-locally-free}
Let $f : X \to S$ be a morphism of schemes.
We say $f$ is {\it finite locally free} if $f$ is
affine and $f_*\mathcal{O}_X$ is a finite locally
free $\mathcal{O}_S$-module. In this case we say $f$ is
has {\it rank} or {\it degree} $d$
if the sheaf $f_*\mathcal{O}_X$ is finite locally free of degree $d$.
\end{definition}

\noindent
Note that if $f : X \to S$ is finite locally free then $S$ is the disjoint
union of open and closed subschemes $S_d$ such that $f^{-1}(S_d) \to S_d$
is finite locally free of degree $d$.

\begin{lemma}
\label{lemma-finite-flat}
Let $f : X \to S$ be a morphism of schemes.
The following are equivalent:
\begin{enumerate}
\item $f$ is finite locally free,
\item $f$ is finite, flat, and locally of finite presentation.
\end{enumerate}
If $S$ is locally Noetherian these are also equivalent to
\begin{enumerate}
\item[(3)] $f$ is finite and flat.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $V \subset S$ be affine open. In all three cases
the morphism is affine hence $f^{-1}(V)$ is affine.
Thus we may write $V = \Spec(R)$ and $f^{-1}(V) = \Spec(A)$
for some $R$-algebra $A$.
Assume (1). This means we can cover $S$ by affine opens
$V = \Spec(R)$ such that $A$ is finite free as an $R$-module.
Then $R \to A$ is of finite presentation by
Algebra, Lemma \ref{algebra-lemma-finite-finite-type}.
Thus (2) holds. Conversely, assume (2).
For every affine open $V = \Spec(R)$ of $S$ the ring map
$R \to A$ is finite and of finite presentation and $A$ is flat
as an $R$-module. By
Algebra, Lemma \ref{algebra-lemma-finite-finitely-presented-extension}
we see that $A$ is finitely presented as an $R$-module.
Thus Algebra, Lemma \ref{algebra-lemma-finite-projective}
implies $A$ is finite locally free. Thus (1) holds.
The Noetherian case follows as a finite module over a Noetherian ring
is a finitely presented module, see Algebra,
Lemma \ref{algebra-lemma-Noetherian-finite-type-is-finite-presentation}.
\end{proof}

\begin{lemma}
\label{lemma-composition-finite-locally-free}
A composition of finite locally free morphisms is finite locally free.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-base-change-finite-locally-free}
A base change of a finite locally free morphism is finite locally free.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-finite-locally-free}
Let $f : X \to S$ be a finite locally free morphism of schemes.
There exists a disjoint union decomposition
$S = \coprod_{d \geq 0} S_d$ by open and closed subschemes
such that setting $X_d = f^{-1}(S_d)$ the restrictions
$f|_{X_d}$ are finite locally free morphisms $X_d \to S_d$
of degree $d$.
\end{lemma}

\begin{proof}
This is true because a finite locally free sheaf locally has
a well defined rank. Details omitted.
\end{proof}

\begin{lemma}
\label{lemma-massage-finite}
Let $f : Y \to X$ be a finite morphism with $X$ affine.
There exists a diagram
$$
\xymatrix{
Z' \ar[rd] &
Y' \ar[l]^i \ar[d] \ar[r] &
Y \ar[d] \\
 & X' \ar[r] & X
}
$$
where
\begin{enumerate}
\item $Y' \to Y$ and $X' \to X$ are surjective finite locally free,
\item $Y' = X' \times_X Y$,
\item $i : Y' \to Z'$ is a closed immersion,
\item $Z' \to X'$ is finite locally free, and
\item $Z' = \bigcup_{j = 1, \ldots, m} Z'_j$ is a (set theoretic)
finite union of closed subschemes, each of which maps isomorphically
to $X'$.
\end{enumerate}
\end{lemma}

\begin{proof}
Write $X = \Spec(A)$ and $Y = \Spec(B)$. See also
More on Algebra, Section \ref{more-algebra-section-descent-flatness-integral}.
Let $x_1, \ldots, x_n \in B$ be generators of $B$ over $A$.
For each $i$ we can choose a monic polynomial $P_i(T) \in A[T]$
such that $P(x_i) = 0$ in $B$. By
Algebra, Lemma \ref{algebra-lemma-adjoin-roots}
(applied $n$ times) there exists a finite locally free ring
extension $A \subset A'$ such that each $P_i$ splits completely:
$$
P_i(T) = \prod\nolimits_{k = 1, \ldots, d_i} (T - \alpha_{ik})
$$
for certain $\alpha_{ik} \in A'$. Set
$$
C = A'[T_1, \ldots, T_n]/(P_1(T_1), \ldots, P_n(T_n))
$$
and $B' = A' \otimes_A B$. The map $C \to B'$, $T_i \mapsto 1 \otimes x_i$
is an $A'$-algebra surjection. Setting $X' = \Spec(A')$,
$Y' = \Spec(B')$ and $Z' = \Spec(C)$ we see that
(1) -- (4) hold. Part (5) holds because set theoretically
$\Spec(C)$ is the union of the closed subschemes
cut out by the ideals
$$
(T_1 - \alpha_{1k_1}, T_2 - \alpha_{2k_2}, \ldots, T_n - \alpha_{nk_n})
$$
for any $1 \leq k_i \leq d_i$.
\end{proof}

\noindent
The following lemma is stated in the correct generality
in Lemma \ref{lemma-image-nowhere-dense-quasi-finite} below.

\begin{lemma}
\label{lemma-image-nowhere-dense-finite}
Let $f : Y \to X$ be a finite morphism of schemes.
Let $T \subset Y$ be a closed nowhere dense subset of $Y$.
Then $f(T) \subset X$ is a closed nowhere dense subset of $X$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-finite-proper} we know that $f(T) \subset X$ is closed.
Let $X = \bigcup X_i$ be an affine covering.
Since $T$ is nowhere dense in $Y$, we see that also $T \cap f^{-1}(X_i)$
is nowhere dense in $f^{-1}(X_i)$. Hence if we can prove the theorem in the
affine case, then we see that $f(T) \cap X_i$ is nowhere dense.
This then implies that $T$ is nowhere dense in $X$ by
Topology, Lemma \ref{topology-lemma-nowhere-dense-local}.

\medskip\noindent
Assume $X$ is affine. Choose a diagram
$$
\xymatrix{
Z' \ar[rd] &
Y' \ar[l]^i \ar[d]^{f'} \ar[r]_a &
Y \ar[d]^f \\
 & X' \ar[r]^b & X
}
$$
as in Lemma \ref{lemma-massage-finite}. The morphisms $a$, $b$ are
open since they are finite locally free
(Lemmas \ref{lemma-finite-flat} and \ref{lemma-fppf-open}).
Hence $T' = a^{-1}(T)$ is nowhere dense, see
Topology, Lemma \ref{topology-lemma-open-inverse-image-closed-nowhere-dense}.
The morphism $b$ is surjective and open.
Hence, if we can prove $f'(T') = b^{-1}(f(T))$ is
nowhere dense, then $f(T)$ is nowhere dense, see
Topology, Lemma \ref{topology-lemma-open-inverse-image-closed-nowhere-dense}.
As $i$ is a closed immersion, by
Topology, Lemma \ref{topology-lemma-closed-image-nowhere-dense}
we see that $i(T') \subset Z'$ is closed and nowhere dense.
Thus we have reduced the problem to the case discussed
in the following paragraph.

\medskip\noindent
Assume that $Y = \bigcup_{i = 1, \ldots, n} Y_i$ is a finite union of
closed subsets, each mapping isomorphically to $X$. Consider
$T_i = Y_i \cap T$. If each of the $T_i$ is nowhere dense in $Y_i$,
then each $f(T_i)$ is nowhere dense in $X$ as $Y_i \to X$ is an isomorphism.
Hence $f(T) = f(T_i)$ is a finite union of nowhere dense closed
subsets of $X$ and we win, see
Topology, Lemma \ref{topology-lemma-nowhere-dense}.
Suppose not, say $T_1$ contains a nonempty open $V \subset Y_1$.
We are going to show this leads to a contradiction.
Consider $Y_2 \cap V \subset V$. This is either
a proper closed subset, or equal to $V$. In the first case we replace
$V$ by $V \setminus V \cap Y_2$, so $V \subset T_1$ is open in $Y_1$ and
does not meet $Y_2$. In the second case we have
$V \subset Y_1 \cap Y_2$ is open in both $Y_1$ and $Y_2$.
Repeat sequentially with $i = 3, \ldots, n$. The result is a disjoint
union decomposition
$$
\{1, \ldots, n\} = I_1 \amalg I_2, \quad 1 \in I_1
$$
and an open $V$ of $Y_1$ contained in $T_1$ such that $V \subset Y_i$
for $i \in I_1$ and $V \cap Y_i = \emptyset$ for $i \in I_2$. Set
$U = f(V)$. This is an open of $X$ since $f|_{Y_1} : Y_1 \to X$ is
an isomorphism. Then
$$
f^{-1}(U) = V\ \amalg\ \bigcup\nolimits_{i \in I_2} (Y_i \cap f^{-1}(U))
$$
As $\bigcup_{i \in I_2} Y_i$ is closed, this implies that
$V \subset f^{-1}(U)$ is open, hence $V \subset Y$ is open.
This contradicts the assumption that $T$ is nowhere dense in $Y$, as desired.
\end{proof}







\section{Rational maps}
\label{section-rational-maps}

\noindent
Let $X$ be a scheme. Note that if $U$, $V$ are dense open
in $X$, then so is $U \cap V$.

\begin{definition}
\label{definition-rational-map}
Let $X$, $Y$ be schemes.
\begin{enumerate}
\item Let $f : U \to Y$, $g : V \to Y$ be morphisms of schemes defined
on dense open subsets $U$, $V$ of $X$. We say that $f$ is
{\it equivalent} to $g$ if $f|_W = g|_W$ for some $W \subset U \cap V$
dense open in $X$.
\item A {\it rational map from $X$ to $Y$}
is an equivalence class for the equivalence relation defined in (1).
\item If $X$, $Y$ are schemes over a base scheme $S$ we say that
a rational map from $X$ to $Y$ is an {\it $S$-rational map from $X$
to $Y$} if there exists a representative $f : U \to Y$ of the equivalence
class which is an $S$-morphism.
\end{enumerate}
\end{definition}

\noindent
We say that two morphisms $f$, $g$ as in (1) of the definition
define the same rational map instead of saying that they are equivalent.
In some cases rational maps are determined by maps on local rings
at generic points.

\begin{lemma}
\label{lemma-rational-map-finite-presentation}
Let $S$ be a scheme. Let $X$ and $Y$ be schemes over $S$. Assume $X$ has
finitely many irreducible components with generic points
$x_1, \ldots, x_n$. Let $s_i \in S$ be the image of $x_i$.
Consider the map
$$
\left\{
\begin{matrix}
S\text{-rational maps} \\
\text{from }X\text{ to }Y
\end{matrix}
\right\}
\longrightarrow
\left\{
\begin{matrix}
(y_1, \varphi_1, \ldots, y_n, \varphi_n)\text{ where }
y_i \in Y\text{ lies over }s_i\text{ and}\\
\varphi_i : \mathcal{O}_{Y, y_i} \to \mathcal{O}_{X, x_i}
\text{ is a local }\mathcal{O}_{S, s_i}\text{-algebra map}
\end{matrix}
\right\}
$$
which sends $f : U \to Y$ to the $2n$-tuple with
$y_i = f(x_i)$ and $\varphi_i = f^\sharp_{x_i}$. Then
\begin{enumerate}
\item If $Y \to S$ is locally of finite type, then the map is injective.
\item If $Y \to S$ is locally of finite presentation, then the map is bijective.
\item If $Y \to S$ is locally of finite type and $X$ reduced,
then the map is bijective.
\end{enumerate}
\end{lemma}

\begin{proof}
Observe that any dense open of $X$ contains the points $x_i$
so the construction makes sense. To prove (1) or (2)
we may replace $X$ by any dense open. Thus if $Z_1, \ldots, Z_n$
are the irreducible components of $X$, then we may replace
$X$ by $X \setminus \bigcup_{i \not = j} Z_i \cap Z_j$.
After doing this $X$ is the disjoint union of its irreducible
components (viewed as open and closed subschemes). Then both the
right hand side and the left hand side of the arrow are products
over the irreducible components and we reduce to the case where
$X$ is irreducible.

\medskip\noindent
Assume $X$ is irreducible with generic point $x$ lying over $s \in S$.
Part (1) follows from part (1) of
Lemma \ref{lemma-morphism-defined-local-ring}.
Parts (2) and (3) follow from part (2) of the same lemma.
\end{proof}

\begin{definition}
\label{definition-rational-function}
Let $X$ be a scheme. A {\it rational function on $X$} is a rational map
from $X$ to $\mathbf{A}^1_{\mathbf{Z}}$.
\end{definition}

\noindent
See Constructions, Definition \ref{constructions-definition-affine-n-space}
for the definition of the affine line $\mathbf{A}^1$. Let $X$ be a scheme
over $S$. For any open $U \subset X$ a morphism
$U \to \mathbf{A}^1_{\mathbf{Z}}$ is the same as a morphism
$U \to \mathbf{A}^1_S$ over $S$. Hence a rational function is
also the same as a $S$-rational map from $X$ into $\mathbf{A}^1_S$.

\medskip\noindent
Recall that we have the canonical identification
$\Mor(T, \mathbf{A}^1_{\mathbf{Z}}) = \Gamma(T, \mathcal{O}_T)$
for any scheme $T$, see Schemes, Example \ref{schemes-example-global-sections}.
Hence $\mathbf{A}^1_{\mathbf{Z}}$ is a ring-object in the
category of schemes. More precisely, the morphisms
\begin{eqnarray*}
+ : \mathbf{A}^1_{\mathbf{Z}} \times \mathbf{A}^1_{\mathbf{Z}}
& \longrightarrow &
\mathbf{A}^1_{\mathbf{Z}} \\
(f, g) & \longmapsto & f + g \\
* : \mathbf{A}^1_{\mathbf{Z}} \times \mathbf{A}^1_{\mathbf{Z}}
& \longrightarrow &
\mathbf{A}^1_{\mathbf{Z}} \\
(f, g) & \longmapsto & fg
\end{eqnarray*}
satisfy all the axioms of the addition and multiplication in a ring
(commutative with $1$ as always). Hence also the set of rational
maps into $\mathbf{A}^1_{\mathbf{Z}}$ has a natural ring structure.

\begin{definition}
\label{definition-ring-of-rational-functions}
Let $X$ be a scheme. The {\it ring of rational functions on $X$}
is the ring $R(X)$ whose elements are rational functions with
addition and multiplication as just described.
\end{definition}

\noindent
For schemes with finitely many irreducible components we can compute this.

\begin{lemma}
\label{lemma-integral-scheme-rational-functions}
Let $X$ be a scheme with finitely many irreducible components
$X_1, \ldots, X_n$. If $\eta_i \in X_i$ is the generic point, then
$$
R(X) = \mathcal{O}_{X, \eta_1} \times \ldots \times \mathcal{O}_{X, \eta_n}
$$
If $X$ is reduced this is equal to $\prod \kappa(\eta_i)$.
If $X$ is integral then $R(X) = \mathcal{O}_{X, \eta} = \kappa(\eta)$
is a field.
\end{lemma}

\begin{proof}
Let $U \subset X$ be an open dense subset. Then
$U_i = (U \cap X_i) \setminus (\bigcup_{j \not = i} X_j)$
is nonempty open as it contained $\eta_i$, contained in $X_i$,
and $\bigcup U_i \subset U \subset X$ is dense.
Thus the identification in the lemma comes from the string of equalities
\begin{align*}
R(X)
& =
\colim_{U \subset X\text{ open dense}} \Mor(U, \mathbf{A}^1_\mathbf{Z}) \\
& =
\colim_{U \subset X\text{ open dense}} \mathcal{O}_X(U) \\
& =
\colim_{\eta_i \in U_i \subset X\text{ open}} \prod \mathcal{O}_X(U_i) \\
& =
\prod \colim_{\eta_i \in U_i \subset X\text{ open}} \mathcal{O}_X(U_i) \\
& =
\prod \mathcal{O}_{X, \eta_i}
\end{align*}
where the second equality is
Schemes, Example \ref{schemes-example-global-sections}.
The final statement follows from
Algebra, Lemma \ref{algebra-lemma-minimal-prime-reduced-ring}.
\end{proof}

\begin{definition}
\label{definition-function-field}
Let $X$ be an integral scheme.
The {\it function field}, or the {\it field of rational functions}
of $X$ is the field $R(X)$.
\end{definition}

\noindent
We may occasionally indicate this field $k(X)$ instead of $R(X)$.
We can use the notion of the function field to elucidate the
separation condition on an integral scheme.
Note that by Lemma \ref{lemma-integral-scheme-rational-functions}
on an integral scheme every local ring $\mathcal{O}_{X, x}$ may be viewed
as a local subring of $R(X)$.

\begin{lemma}
\label{lemma-distinct-local-rings}
Let $X$ be an integral separated scheme.
Let $Z_1$, $Z_2$ be distinct irreducible closed subsets of $X$.
Let $\eta_i$ be the generic point of $Z_i$.
If $Z_1 \not\subset Z_2$, then
$\mathcal{O}_{X, \eta_1} \not \subset \mathcal{O}_{X, \eta_2}$
as subrings of $R(X)$.
In particular, if $Z_1 = \{x\}$ consists of one closed point $x$,
there exists a function regular in a neighborhood of $x$
which is not in $\mathcal{O}_{X, \eta_{2}}$.
\end{lemma}

\begin{proof}
First observe that under the assumption of $X$ being separated,
there is a unique map of schemes
$\Spec(\mathcal{O}_{X, \eta_2}) \to X$ over $X$
such that the composition
$$
\Spec(R(X)) \longrightarrow
\Spec(\mathcal{O}_{X, \eta_2}) \longrightarrow X
$$
is the canonical map $\Spec(R(X)) \to X$.
Namely, there is the canonical map
$can : \Spec(\mathcal{O}_{X, \eta_2}) \to X$, see
Schemes, Equation (\ref{schemes-equation-canonical-morphism}).
Given a second morphism $a$ to $X$, we have that $a$ agrees with $can$
on the generic point of
$\Spec(\mathcal{O}_{X, \eta_2})$ by assumption.
Now $X$ being separated guarantees that the subset in
$\Spec(\mathcal{O}_{X, \eta_2})$ where
these two maps agree is closed, see
Schemes, Lemma \ref{schemes-lemma-where-are-they-equal}.
Hence $a = can$ on all of $\Spec(\mathcal{O}_{X, \eta_2})$.

\medskip\noindent
Assume $Z_1 \not \subset Z_2$ and assume on the contrary that
$\mathcal{O}_{X, \eta_{1}} \subset \mathcal{O}_{X, \eta_{2}}$
as subrings of $R(X)$. Then we would obtain a second morphism
$$
\Spec(\mathcal{O}_{X, \eta_{2}}) \longrightarrow
\Spec(\mathcal{O}_{X, \eta_{1}}) \longrightarrow
X.
$$
By the above this composition would have to be equal to $can$.
This implies that $\eta_2$ specializes to $\eta_1$ (see
Schemes, Lemma \ref{schemes-lemma-specialize-points}).
But this contradicts our assumption $Z_1 \not \subset Z_2$.
\end{proof}

\begin{definition}
\label{definition-domain-of-definition}
Let $\varphi$ be a rational map between two schemes $X$ and $Y$. We say
$\varphi$ is {\it defined in a point $x \in X$} if there exists a
representative $(U, f)$ of $\varphi$ with $x \in U$. The
{\it domain of definition} of $\varphi$ is the set of all points
where $\varphi$ is defined.
\end{definition}

\noindent
With this definition it isn't true in general that $\varphi$ has a
representative which is defined on all of the domain of definition.

\begin{lemma}
\label{lemma-rational-map-from-reduced-to-separated}
Let $X$ and $Y$ be schemes. Assume $X$ reduced and $Y$ separated. Let
$\varphi$ be a rational map from $X$ to $Y$ with domain of definition
$U \subset X$. Then there exists a unique morphism $f : U \to Y$
representing $\varphi$. If $X$ and $Y$ are schemes over a separated
scheme $S$ and if $\varphi$ is an $S$-rational map, then $f$ is a
morphism over $S$.
\end{lemma}

\begin{proof}
Let $(V, g)$ and $(V', g')$ be representatives of $\varphi$. Then
$g, g'$ agree on a dense open subscheme $W \subset V \cap V'$.
On the other hand, the equalizer $E$ of $g|_{V \cap V'}$ and $g'|_{V \cap V'}$
is a closed subscheme of $V \cap V'$ (Schemes, Lemma
\ref{schemes-lemma-where-are-they-equal}). Now $W \subset E$
implies that $E = V \cap V'$ set theoretically. As $V \cap V'$
is reduced we conclude $E = V \cap V'$ scheme theoretically, i.e.,
$g|_{V \cap V'} = g'|_{V \cap V'}$. It follows that we can glue the
representatives $g : V \to Y$ of $\varphi$ to a morphism $f : U \to Y$, see
Schemes, Lemma \ref{schemes-lemma-glue}.
We omit the proof of the final statement.
\end{proof}

\noindent
In general it does not make sense to compose rational maps. The reason
is that the image of a representative of the first rational map may
have empty intersection with the domain of definition of the second.
However, if we assume that our schemes are irreducible and we look
at dominant rational maps, then we can compose rational maps.

\begin{definition}
\label{definition-dominant-rational}
Let $X$ and $Y$ be irreducible schemes. A rational map from $X$ to $Y$
is called {\it dominant} if any representative $f : U \to Y$ is a dominant
morphism of schemes.
\end{definition}

\noindent
By Lemma \ref{lemma-dominant-finite-number-irreducible-components}
it is equivalent to require that the generic point $\eta \in X$
maps to the generic point $\xi$ of $Y$, i.e., $f(\eta) = \xi$ for
any representative $f : U \to Y$. We can compose a dominant rational map
$\varphi$ between irreducible schemes $X$ and $Y$ with an arbitrary rational
map $\psi$ from $Y$ to $Z$. Namely, choose
representatives $f : U \to Y$ with $U \subset X$ open dense
and $g : V \to Z$ with $V \subset Y$ open dense. Then
$W = f^{-1}(V) \subset X$ is open nonempty (because it contains the
generic point of $X$) and we let $\psi \circ \varphi$ be the
equivalence class of $g \circ f|_W : W \to Z$. We omit the verification
that this is well defined.

\medskip\noindent
In this way we obtain a category whose objects are irreducible schemes
and whose morphisms are dominant rational maps. Given a base scheme
$S$ we can similarly define a category whose objects are irreducible schemes
over $S$ and whose morphisms are dominant $S$-rational maps.

\begin{definition}
\label{definition-birational-schemes}
Let $X$ and $Y$ be irreducible schemes.
\begin{enumerate}
\item We say $X$ and $Y$ are {\it birational} if $X$ and $Y$ are isomorphic
in the category of irreducible schemes and dominant rational maps.
\item Assume $X$ and $Y$ are schemes over a base scheme $S$.
We say $X$ and $Y$ are {\it $S$-birational} if $X$ and $Y$ are
isomorphic in the category of irreducible schemes over $S$ and
dominant $S$-rational maps.
\end{enumerate}
\end{definition}

\noindent
If $X$ and $Y$ are birational irreducible schemes, then the set of rational
maps from $X$ to $Z$ is bijective with the set of rational map from $Y$ to $Z$
for all schemes $Z$ (functorially in $Z$). For ``general'' irreducible schemes
this is just one possible definition. Another would be
to require $X$ and $Y$ have isomorphic rings of rational functions. For
varieties these conditions are equivalent, see
Lemma \ref{lemma-criterion-birational-finite-presentation}.

\begin{lemma}
\label{lemma-birational-integral}
Let $X$ and $Y$ be irreducible schemes.
\begin{enumerate}
\item The schemes $X$ and $Y$ are birational if and only if they have
isomorphic nonempty opens.
\item Assume $X$ and $Y$ are schemes over a base scheme $S$. Then
$X$ and $Y$ are $S$-birational if and only if there are nonempty
opens $U \subset X$ and $V \subset Y$ which are $S$-isomorphic.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume $X$ and $Y$ are birational. Let $f : U \to Y$ and $g : V \to X$
define inverse dominant rational maps from $X$ to $Y$ and from $Y$ to $X$.
We may assume $V$ affine. We may replace $U$ by an affine open of $f^{-1}(V)$.
As $g \circ f$ is the identity as a dominant rational map, we see that
the composition $U \to V \to X$ is the identity on a dense open of $U$.
Thus after replacing $U$ by a smaller affine open we may assume that
$U \to V \to X$ is the inclusion of $U$ into $X$. It follows that
$U \to V$ is an immersion
(apply Schemes, Lemma \ref{schemes-lemma-section-immersion}
to $U \to g^{-1}(U) \to U$).
However, switching the roles of $U$ and $V$ and redoing the argument
above, we see that there exists a nonempty affine open $V' \subset V$
such that the inclusion factors as $V' \to U \to V$. Then $V' \to U$ is
necessarily an open immersion. Namely, $V' \to f^{-1}(V') \to V'$ are
monomorphisms
(Schemes, Lemma \ref{schemes-lemma-immersions-monomorphisms})
composing to the identity, hence isomorphisms.
Thus $V'$ is isomorphic to an open of both $X$ and $Y$.
In the $S$-rational maps case, the exact same argument works.
\end{proof}

\begin{remark}
\label{remark-generalize-category}
Here is a generalization of the category of irreducible schemes and
dominant rational maps. For a scheme $X$ denote $X^0$ the set of
points $x \in X$ with $\dim(\mathcal{O}_{X, x}) = 0$, in other words,
$X^0$ is the set of generic points of irreducible components of $X$.
Then we can consider the category with
\begin{enumerate}
\item objects are schemes $X$ such that every quasi-compact open has
finitely many irreducible components, and
\item morphisms from $X$ to $Y$ are rational maps $f : U \to Y$
from $X$ to $Y$ such that $f(U^0) = Y^0$.
\end{enumerate}
If $U \subset X$ is a dense open of a scheme, then
$U^0 \subset X^0$ need not be an equality, but if $X$ is an
object of our category, then this is the case.
Thus given two morphisms in our category, the composition
is well defined and a morphism in our category.
\end{remark}

\begin{remark}
\label{remark-pseudo-morphisms}
There is a variant of Definition \ref{definition-rational-map}
where we consider only those morphism $U \to Y$ defined on
scheme theoretically dense open subschemes $U \subset X$.
We use Lemma \ref{lemma-intersection-scheme-theoretically-dense}
to see that we obtain an equivalence relation.
An equivalence class of these is called a
{\it pseudo-morphism from $X$ to $Y$}.
If $X$ is reduced the two notions coincide.
\end{remark}






\section{Birational morphisms}
\label{section-birational}

\noindent
You may be used to the notion of a birational map of varieties
having the property that it is an isomorphism over an open subset
of the target. However, in general a birational morphism may
not be an isomorphism over any nonempty open, see
Example \ref{example-birational-not-iso-over-open}.
Here is the formal definition.

\begin{definition}
\label{definition-birational}
\begin{reference}
\cite[(2.2.9)]{EGA1}
\end{reference}
Let $X$, $Y$ be schemes. Assume $X$ and $Y$ have finitely many
irreducible components. We say a morphism $f : X \to Y$ is
{\it birational} if
\begin{enumerate}
\item $f$ induces a bijection between the set of generic points
of irreducible components of $X$ and the set of generic points
of the irreducible components of $Y$, and
\item for every generic point $\eta \in X$ of an irreducible component
of $X$ the local ring map
$\mathcal{O}_{Y, f(\eta)} \to \mathcal{O}_{X, \eta}$
is an isomorphism.
\end{enumerate}
\end{definition}

\noindent
We will see below that the fibres of a birational morphism
over generic points are singletons. Moreover, we will see that
in most cases one encounters in practice the existence of a birational morphism
between irreducible schemes $X$ and $Y$ implies
$X$ and $Y$ are birational schemes.

\begin{lemma}
\label{lemma-birational-dominant}
Let $f : X \to Y$ be a morphism of schemes having finitely
many irreducible components. If $f$ is birational then
$f$ is dominant.
\end{lemma}

\begin{proof}
Follows from Lemma \ref{lemma-generic-points-in-image-dominant}
and the definition.
\end{proof}

\begin{lemma}
\label{lemma-birational-generic-fibres}
Let $f : X \to Y$ be a birational morphism of schemes having finitely
many irreducible components. If $y \in Y$ is the generic point of
an irreducible component, then the base change
$X \times_Y \Spec(\mathcal{O}_{Y, y}) \to \Spec(\mathcal{O}_{Y, y})$
is an isomorphism.
\end{lemma}

\begin{proof}
We may assume $Y = \Spec(B)$ is affine and irreducible.
Then $X$ is irreducible too. If we prove the result for any nonempty
affine open $U \subset X$, then the result holds for $X$
(small argument omitted). Hence we may assume $X$
is affine too, say $X = \Spec(A)$.
Let $y \in Y$ correspond to the minimal prime $\mathfrak q \subset B$.
By assumption $A$ has a unique minimal prime $\mathfrak p$ lying
over $\mathfrak q$ and $B_\mathfrak q \to A_\mathfrak p$ is an isomorphism.
It follows that $A_\mathfrak q \to \kappa(\mathfrak p)$ is surjective,
hence $\mathfrak p A_\mathfrak q$ is a maximal ideal. On the other hand
$\mathfrak p A_\mathfrak q$ is the unique minimal prime of $A_\mathfrak q$.
We conclude that $\mathfrak p A_\mathfrak q$ is the unique prime of
$A_\mathfrak q$ and that $A_\mathfrak q = A_\mathfrak p$. Since
$A_\mathfrak q = A \otimes_B B_\mathfrak q$ the lemma follows.
\end{proof}

\begin{example}
\label{example-birational-not-iso-over-open}
Here are two examples of birational morphisms which are not isomorphisms
over any open of the target.

\medskip\noindent
First example. Let $k$ be an infinite field. Let $A = k[x]$. Let
$B = k[x, \{y_{\alpha}\}_{\alpha \in k}]/
((x-\alpha)y_\alpha, y_\alpha y_\beta)$.
There is an inclusion $A \subset B$ and a retraction $B \to A$
setting all $y_\alpha$ equal to zero.
Both the morphism $\Spec(A) \to \Spec(B)$
and the morphism $\Spec(B) \to \Spec(A)$ are birational
but not an isomorphism over any open.

\medskip\noindent
Second example. Let $A$ be a domain. Let $S \subset A$ be a multiplicative
subset not containing $0$.
With $B = S^{-1}A$ the morphism $f : \Spec(B) \to \Spec(A)$
is birational. If there exists an open $U$ of $\Spec(A)$
such that $f^{-1}(U) \to U$ is an isomorphism, then there exists an
$a \in A$ such that each every element of $S$ becomes invertible
in the principal localization $A_a$. Taking $A = \mathbf{Z}$
and $S$ the set of odd integers give a counter example.
\end{example}

\begin{lemma}
\label{lemma-birational-birational}
Let $f : X \to Y$ be a birational morphism of schemes having finitely
many irreducible components over a base scheme $S$. Assume one of the
following conditions is satisfied
\begin{enumerate}
\item $f$ is locally of finite type and $Y$ reduced,
\item $f$ is locally of finite presentation.
\end{enumerate}
Then there exist dense opens $U \subset X$ and $V \subset Y$
such that $f(U) \subset V$ and $f|_U : U \to V$ is an isomorphism.
In particular if $X$ and $Y$ are irreducible, then
$X$ and $Y$ are $S$-birational.
\end{lemma}

\begin{proof}
There is an immediate reduction to the case where $X$ and $Y$ are irreducible
which we omit. Moreover, after shrinking further and we may assume $X$ and
$Y$ are affine, say $X = \Spec(A)$ and $Y = \Spec(B)$.
By assumption $A$, resp.\ $B$ has a unique minimal prime $\mathfrak p$,
resp.\ $\mathfrak q$, the prime $\mathfrak p$ lies over $\mathfrak q$, and
$B_\mathfrak q = A_\mathfrak p$.
By Lemma \ref{lemma-birational-generic-fibres} we have
$B_\mathfrak q = A_\mathfrak q = A_\mathfrak p$.

\medskip\noindent
Suppose $B \to A$ is of finite type, say $A = B[x_1, \ldots, x_n]$.
There exist a $b_i \in B$ and $g_i \in B \setminus \mathfrak q$
such that $b_i/g_i$ maps to the image of $x_i$ in $A_\mathfrak q$.
Hence $b_i  - g_ix_i$ maps to zero in $A_{g_i'}$ for some
$g_i' \in B \setminus \mathfrak q$. Setting $g = \prod g_i g'_i$
we see that $B_g \to A_g$ is surjective. If moreover $Y$ is reduced,
then the map $B_g \to B_\mathfrak q$ is injective and hence
$B_g \to A_g$ is injective as well. This proves case (1).

\medskip\noindent
Proof of (2). By the argument given in the previous paragraph we may
assume that $B \to A$ is surjective. As $f$ is locally of finite presentation
the kernel $J \subset B$ is a finitely generated ideal. Say
$J = (b_1, \ldots, b_r)$. Since $B_\mathfrak q = A_\mathfrak q$
there exist $g_i \in B \setminus \mathfrak q$ such that
$g_i b_i = 0$. Setting $g = \prod g_i$ we see that $B_g \to A_g$
is an isomorphism.
\end{proof}

\begin{lemma}
\label{lemma-criterion-birational-finite-presentation}
Let $S$ be a scheme. Let $X$ and $Y$ be irreducible schemes
locally of finite presentation over $S$. Let $x \in X$ and $y \in Y$
be the generic points. The following are equivalent
\begin{enumerate}
\item $X$ and $Y$ are $S$-birational,
\item there exist nonempty opens of $X$ and $Y$
which are $S$-isomorphic, and
\item $x$ and $y$ map to the same point $s$ of $S$ and
$\mathcal{O}_{X, x}$ and $\mathcal{O}_{Y, y}$ are isomorphic as
$\mathcal{O}_{S, s}$-algebras.
\end{enumerate}
\end{lemma}

\begin{proof}
We have seen the equivalence of (1) and (2) in
Lemma \ref{lemma-birational-integral}.
It is immediate that (2) implies (3).
To finish we assume (3) holds and we prove (1).
By Lemma \ref{lemma-rational-map-finite-presentation}
there is a rational map $f : U \to Y$
which sends $x \in U$ to $y$ and induces
the given isomorphism $\mathcal{O}_{Y, y} \cong \mathcal{O}_{X, x}$.
Thus $f$ is a birational morphism and hence induces
an isomorphism on nonempty opens
by Lemma \ref{lemma-birational-birational}.
This finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-common-open}
Let $S$ be a scheme. Let $X$ and $Y$ be integral schemes locally
of finite type over $S$. Let $x \in X$ and $y \in Y$ be the generic points.
The following are equivalent
\begin{enumerate}
\item $X$ and $Y$ are $S$-birational,
\item there exist nonempty opens of $X$ and $Y$ which are $S$-isomorphic, and
\item $x$ and $y$ map to the same point $s \in S$ and
$\kappa(x) \cong \kappa(y)$ as $\kappa(s)$-extensions.
\end{enumerate}
\end{lemma}

\begin{proof}
We have seen the equivalence of (1) and (2) in
Lemma \ref{lemma-birational-integral}.
It is immediate that (2) implies (3).
To finish we assume (3) holds and we prove (1).
Observe that $\mathcal{O}_{X, x} = \kappa(x)$ and
$\mathcal{O}_{Y, y} = \kappa(y)$ by
Algebra, Lemma \ref{algebra-lemma-minimal-prime-reduced-ring}.
By Lemma \ref{lemma-rational-map-finite-presentation}
there is a rational map $f : U \to Y$
which sends $x \in U$ to $y$ and induces
the given isomorphism $\mathcal{O}_{Y, y} \cong \mathcal{O}_{X, x}$.
Thus $f$ is a birational morphism and hence induces
an isomorphism on nonempty opens
by Lemma \ref{lemma-birational-birational}.
This finishes the proof.
\end{proof}







\section{Generically finite morphisms}
\label{section-generically-finite}

\noindent
In this section we characterize maps between schemes
which are locally of finite type and which are ``generically finite''
in some sense.

\begin{lemma}
\label{lemma-generically-finite}
Let $X$, $Y$ be schemes.
Let $f : X \to Y$ be locally of finite type.
Let $\eta \in Y$ be a generic point of an irreducible component
of $Y$. The following are equivalent:
\begin{enumerate}
\item the set $f^{-1}(\{\eta\})$ is finite,
\item there exist affine opens $U_i \subset X$, $i = 1, \ldots, n$
and $V \subset Y$ with $f(U_i) \subset V$,
$\eta \in V$ and $f^{-1}(\{\eta\}) \subset \bigcup U_i$
such that each $f|_{U_i} : U_i \to V$ is finite.
\end{enumerate}
If $f$ is quasi-separated, then these are also equivalent to
\begin{enumerate}
\item[(3)] there exist affine opens $V \subset Y$,
and $U \subset X$ with $f(U) \subset V$,
$\eta \in V$ and $f^{-1}(\{\eta\}) \subset U$
such that $f|_U : U \to V$ is finite.
\end{enumerate}
If $f$ is quasi-compact and quasi-separated,
then these are also equivalent to
\begin{enumerate}
\item[(4)] there exists an affine open $V \subset Y$, $\eta \in V$
such that $f^{-1}(V) \to V$ is finite.
\end{enumerate}
\end{lemma}

\begin{proof}
The question is local on the base. Hence we may replace $Y$ by an
affine neighbourhood of $\eta$, and we may and do assume throughout
the proof below that $Y$ is affine, say $Y = \Spec(R)$.

\medskip\noindent
It is clear that (2) implies (1).
Assume that $f^{-1}(\{\eta\}) = \{\xi_1, \ldots, \xi_n\}$ is finite.
Choose affine opens $U_i \subset X$ with $\xi_i \in U_i$.
By Algebra, Lemma \ref{algebra-lemma-generically-finite} we see
that after replacing $Y$ by a standard open in
$Y$ each of the morphisms $U_i \to Y$ is finite.
In other words (2) holds.

\medskip\noindent
It is clear that (3) implies (1). Assume $f$ is quasi-separated and (1).
Write $f^{-1}(\{\eta\}) = \{\xi_1, \ldots, \xi_n\}$. There are no
specializations among the $\xi_i$ by Lemma \ref{lemma-finite-fibre}.
Since each $\xi_i$ maps to the generic
point $\eta$ of an irreducible component of $Y$, there cannot be a
nontrivial specialization $\xi \leadsto \xi_i$ in $X$
(since $\xi$ would map to $\eta$ as well).
We conclude each $\xi_i$ is a generic point of an
irreducible component of $X$.
Since $Y$ is affine and $f$ quasi-separated we see $X$ is quasi-separated.
By Properties, Lemma \ref{properties-lemma-maximal-points-affine}
we can find an affine open $U \subset X$ containing each $\xi_i$.
By Algebra, Lemma \ref{algebra-lemma-generically-finite} we see
that after replacing $Y$ by a standard open in
$Y$ the morphisms $U \to Y$ is finite.
In other words (3) holds.

\medskip\noindent
It is clear that (4) implies all of (1) -- (3) with no further assumptions
on $f$. Suppose that $f$ is quasi-compact and quasi-separated. We have to
show that the equivalent conditions (1) -- (3) imply (4).
Let $U$, $V$ be as in (3). Replace $Y$ by $V$. Since $f$ is quasi-compact
and $Y$ is quasi-compact (being affine) we see that $X$ is quasi-compact.
Hence $Z = X \setminus U$ is quasi-compact, hence the morphism
$f|_Z : Z \to Y$ is quasi-compact. By construction of $Z$ we see that
$\eta \not \in f(Z)$. Hence by
Lemma \ref{lemma-quasi-compact-generic-point-not-in-image}
we see that there exists an affine open
neighbourhood $V'$ of $\eta$ in $Y$ such that $f^{-1}(V') \cap Z = \emptyset$.
Then we have $f^{-1}(V') \subset U$ and this means
that $f^{-1}(V') \to V'$ is finite.
\end{proof}

\begin{example}
\label{example-counter-generically-finite}
Let $A = \prod_{n \in \mathbf{N}} \mathbf{F}_2$.
Every element of $A$ is an idempotent. Hence every prime ideal is maximal
with residue field $\mathbf{F}_2$.
Thus the topology on $X = \Spec(A)$ is totally disconnected
and quasi-compact. The projection maps $A \to \mathbf{F}_2$ define open
points of $\Spec(A)$. It cannot be the case that all the points
of $X$ are open since $X$ is quasi-compact. Let $x \in X$ be a closed
point which is not open. Then we can form a scheme $Y$ which is two
copies of $X$ glued along $X \setminus \{x\}$. In other words, this
is $X$ with $x$ doubled, compare
Schemes, Example \ref{schemes-example-affine-space-zero-doubled}.
The morphism
$f : Y \to X$ is quasi-compact, finite type and has finite fibres
but is not quasi-separated.
The point $x \in X$ is a generic point of an irreducible component
of $X$ (since $X$ is totally disconnected). But properties (3) and (4)
of Lemma \ref{lemma-generically-finite} do not hold. The reason is that
for any open neighbourhood $x \in U \subset X$ the inverse image
$f^{-1}(U)$ is not affine because functions on $f^{-1}(U)$ cannot
separate the two points lying over $x$ (proof omitted; this is a
nice exercise). Hence the condition that $f$ is quasi-separated is
necessary in parts (3) and (4) of the lemma.
\end{example}

\begin{remark}
\label{remark-quasi-finite-finite-over-dense-open}
An alternative to
Lemma \ref{lemma-generically-finite}
is the statement that a quasi-finite morphism is finite
over a dense open of the target. This will be shown in
More on Morphisms,
Lemma \ref{more-morphisms-lemma-quasi-finite-finite-over-dense-open}.
\end{remark}

\begin{lemma}
\label{lemma-quasi-finiteness-over-generic-point}
Let $X$, $Y$ be schemes. Let $f : X \to Y$ be locally of finite type.
Let $X^0$, resp.\ $Y^0$ denote the set of generic points of irreducible
components of $X$, resp.\ $Y$. Let $\eta \in Y^0$. The following are
equivalent
\begin{enumerate}
\item $f^{-1}(\{\eta\}) \subset X^0$,
\item $f$ is quasi-finite at all points lying over $\eta$,
\item $f$ is quasi-finite at all $\xi \in X^0$ lying over $\eta$.
\end{enumerate}
\end{lemma}

\begin{proof}
Condition (1) implies there are no specializations among the points
of the fibre $X_\eta$. Hence (2) holds by
Lemma \ref{lemma-quasi-finite-at-point-characterize}.
The implication (2) $\Rightarrow$ (3) is immediate.
Since $\eta$ is a generic point of $Y$, the generic points of $X_\eta$
are generic points of $X$. Hence (3) and 
Lemma \ref{lemma-quasi-finite-at-point-characterize}
imply the generic points of $X_\eta$ are also closed.
Thus all points of $X_\eta$ are generic and we see that (1) holds.
\end{proof}

\begin{lemma}
\label{lemma-finite-over-dense-open}
Let $X$, $Y$ be schemes. Let $f : X \to Y$ be locally of finite type.
Let $X^0$, resp.\ $Y^0$ denote the set of generic points of irreducible
components of $X$, resp.\ $Y$. Assume
\begin{enumerate}
\item $X^0$ and $Y^0$ are finite and $f^{-1}(Y^0) = X^0$,
\item either $f$ is quasi-compact or $f$ is separated.
\end{enumerate}
Then there exists a dense open $V \subset Y$
such that $f^{-1}(V) \to V$ is finite.
\end{lemma}

\begin{proof}
Since $Y$ has finitely many irreducible components, we can find a dense
open which is a disjoint union of its irreducible components. Thus we may
assume $Y$ is irreducible affine with generic point $\eta$. Then the fibre
over $\eta$ is finite as $X^0$ is finite.

\medskip\noindent
Assume $f$ is separated and $Y$ irreducible affine. Choose $V \subset Y$
and $U \subset X$ as in Lemma \ref{lemma-generically-finite} part (3).
Since $f|_U : U \to V$ is finite, we see that $U \subset f^{-1}(V)$
is closed as well as open (Lemmas \ref{lemma-image-proper-scheme-closed} and
\ref{lemma-finite-proper}). Thus $f^{-1}(V) = U \amalg W$ for some
open subscheme $W$ of $X$. However, since $U$ contains all the generic
points of $X$ we conclude that $W = \emptyset$ as desired.

\medskip\noindent
Assume $f$ is quasi-compact and $Y$ irreducible affine. Then $X$ is
quasi-compact, hence there exists a dense open subscheme $U \subset X$
which is separated
(Properties, Lemma \ref{properties-lemma-quasi-compact-dense-open-separated}).
Since the set of generic points $X^0$ is finite, we see that $X^0 \subset U$.
Thus $\eta \not \in f(X \setminus U)$. Since $X \setminus U \to Y$ is
quasi-compact, we conclude that there is a nonempty open $V \subset Y$
such that $f^{-1}(V) \subset U$, see Lemma \ref{lemma-quasi-compact-dominant}.
After replacing $X$ by $f^{-1}(V)$ and $Y$ by $V$ we reduce to the
separated case which we dealt with in the preceding paragraph.
\end{proof}

\begin{lemma}
\label{lemma-birational-isomorphism-over-dense-open}
Let $X$, $Y$ be schemes. Let $f : X \to Y$ be a birational morphism
between schemes which have finitely many irreducible components.
Assume
\begin{enumerate}
\item either $f$ is quasi-compact or $f$ is separated, and
\item either $f$ is locally of finite type and $Y$ is reduced or
$f$ is locally of finite presentation.
\end{enumerate}
Then there exists a dense open $V \subset Y$
such that $f^{-1}(V) \to V$ is an isomorphism.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-finite-over-dense-open} we may assume that $f$ is finite.
Since $Y$ has finitely many irreducible components, we can find a dense
open which is a disjoint union of its irreducible components. Thus we may
assume $Y$ is irreducible. By Lemma \ref{lemma-birational-birational} we find
a nonempty open $U \subset X$ such that $f|_U : U \to Y$ is an open immersion.
After removing the closed (as $f$ finite)
subset $f(X \setminus U)$ from $Y$ we see that $f$ is an isomorphism.
\end{proof}

\begin{lemma}
\label{lemma-finite-degree}
Let $X$, $Y$ be integral schemes.
Let $f : X \to Y$ be locally of finite type.
Assume $f$ is dominant.
The following are equivalent:
\begin{enumerate}
\item the extension $R(Y) \subset R(X)$ has
transcendence degree $0$,
\item the extension $R(Y) \subset R(X)$ is finite,
\item there exist nonempty affine opens $U \subset X$
and $V \subset Y$ such that $f(U) \subset V$
and $f|_U : U \to V$ is finite, and
\item the generic point of $X$ is the only point of $X$ mapping to
the generic point of $Y$.
\end{enumerate}
If $f$ is separated or if $f$ is quasi-compact, then these are
also equivalent to
\begin{enumerate}
\item[(5)] there exists a nonempty affine open $V \subset Y$ such
that $f^{-1}(V) \to V$ is finite.
\end{enumerate}
\end{lemma}

\begin{proof}
Choose any affine opens $\Spec(A) = U \subset X$
and $\Spec(R) = V \subset Y$ such that $f(U) \subset V$.
Then $R$ and $A$ are domains by definition. The ring map
$R \to A$ is of finite type
(Lemma \ref{lemma-locally-finite-type-characterize}).
By Lemma \ref{lemma-dominant-finite-number-irreducible-components}
the generic point of $X$ maps to the generic point of $Y$
hence $R \to A$ is injective. Let $K = R(Y)$ be the fraction field
of $R$ and $L = R(X)$ the fraction field of $A$. Then $L/K$
is a finitely generated field extension. Hence we see that
(1) is equivalent to (2).

\medskip\noindent
Suppose (2) holds. Let $x_1, \ldots, x_n \in A$ be generators
of $A$ over $R$. By assumption there exist nonzero polynomials
$P_i(X) \in R[X]$ such that $P_i(x_i) = 0$. Let $f_i \in R$ be the
leading coefficient of $P_i$. Then we conclude that
$R_{f_1 \ldots f_n} \to A_{f_1 \ldots f_n}$ is finite, i.e., (3) holds.
Note that (3) implies (2). So now we see that (1), (2) and (3) are all
equivalent.

\medskip\noindent
Let $\eta$ be the generic point of $X$, and let $\eta' \in Y$ be the
generic point of $Y$. Assume (4). Then
$\dim_\eta(X_{\eta'}) = 0$ and we see that $R(X) = \kappa(\eta)$ has
transcendence degree $0$ over $R(Y) = \kappa(\eta')$ by
Lemma \ref{lemma-dimension-fibre-at-a-point}.
In other words (1) holds. Assume the equivalent conditions (1), (2) and
(3). Suppose that $x \in X$ is a point mapping to $\eta'$.
As $x$ is a specialization of $\eta$,
this gives inclusions $R(Y) \subset \mathcal{O}_{X, x} \subset R(X)$,
which implies $\mathcal{O}_{X, x}$ is a field, see
Algebra, Lemma \ref{algebra-lemma-integral-over-field}.
Hence $x = \eta$. Thus we see that (1) -- (4)
are all equivalent.

\medskip\noindent
It is clear that (5) implies (3) with no additional assumptions on
$f$. What remains is to prove that if $f$ is either separated or
quasi-compact, then the equivalent conditions (1) -- (4) imply (5).
This follows from Lemma \ref{lemma-finite-over-dense-open}.
\end{proof}

\begin{definition}
\label{definition-degree}
Let $X$ and $Y$ be integral schemes.
Let $f : X \to Y$ be locally of finite type and dominant.
Assume $[R(X) : R(Y)] < \infty$, or any other of the equivalent
conditions (1) -- (4) of Lemma \ref{lemma-finite-degree}.
Then the positive integer
$$
\deg(X/Y) = [R(X) : R(Y)]
$$
is called the {\it degree of $X$ over $Y$}.
\end{definition}

\noindent
It is possible to extend this notion to a morphism
$f : X \to Y$ if (a) $Y$ is integral with generic point $\eta$,
(b) $f$ is locally of finite type, and (c) $f^{-1}(\{\eta\})$ is finite.
In this case we can define
$$
\deg(X/Y)
=
\sum\nolimits_{\xi \in X, \ f(\xi) = \eta}
\dim_{R(Y)} (\mathcal{O}_{X, \xi}).
$$
Namely, given that $R(Y) = \kappa(\eta) = \mathcal{O}_{Y, \eta}$
(Lemma \ref{lemma-integral-scheme-rational-functions})
the dimensions above are finite by
Lemma \ref{lemma-generically-finite} above.
However, for most applications the definition given above
is the right one.

\begin{lemma}
\label{lemma-degree-composition}
Let $X$, $Y$, $Z$ be integral schemes.
Let $f : X \to Y$ and $g : Y \to Z$ be dominant morphisms locally
of finite type. Assume that $[R(X) : R(Y)] < \infty$ and
$[R(Y) : R(Z)] < \infty$. Then
$$
\deg(X/Z) = \deg(X/Y) \deg(Y/Z).
$$
\end{lemma}

\begin{proof}
This comes from the multiplicativity of degrees in towers
of finite extensions of fields, see
Fields, Lemma \ref{fields-lemma-multiplicativity-degrees}.
\end{proof}

\begin{remark}
\label{remark-definition-generically-finite}
Let $f : X \to Y$ be a morphism of schemes which is locally of finite type.
There are (at least) two properties that we could use to define
{\it generically finite} morphisms. These correspond to whether you
want the property to be local on the source or local on the target:
\begin{enumerate}
\item (Local on the target; suggested by Ravi Vakil.)
Assume every quasi-compact open of $Y$ has finitely
many irreducible components (for example if $Y$ is locally Noetherian).
The requirement is that the inverse image of each generic point is finite, see
Lemma \ref{lemma-generically-finite}.
\item (Local on the source.) The requirement is that there exists
a dense open $U \subset X$ such that $U \to Y$ is locally quasi-finite.
\end{enumerate}
In case (1) the requirement can be formulated without the auxiliary
condition on $Y$, but probably doesn't give the right notion for
general schemes. Property (2) as formulated doesn't imply that the fibres
over generic points are finite; however, if $f$ is
quasi-compact and $Y$ is as in (1) then it does.
\end{remark}

\begin{definition}
\label{definition-modification}
Let $X$ be an integral scheme. A {\it modification of $X$}
is a birational proper morphism $f : X' \to X$ with $X'$
integral.
\end{definition}

\noindent
Let $f : X' \to X$ be a modification as in the definition. By
Lemma \ref{lemma-finite-degree} there exists a nonempty $U \subset X$ such
that $f^{-1}(U) \to U$ is finite. By generic flatness
(Proposition \ref{proposition-generic-flatness})
we may assume $f^{-1}(U) \to U$ is flat and of finite presentation.
So $f^{-1}(U) \to U$ is finite locally free (Lemma \ref{lemma-finite-flat}).
Since $f$ is birational, the degree of $X'$ over $X$ is $1$.
Hence $f^{-1}(U) \to U$ is finite locally free of degree $1$,
in other words it is an isomorphism. Thus we can {\it redefine} a
modification to be a proper morphism $f : X' \to X$ of integral schemes
such that $f^{-1}(U) \to U$ is an isomorphism for some nonempty open
$U \subset X$.

\begin{definition}
\label{definition-alteration}
\begin{reference}
\cite[Definition 2.20]{alterations}
\end{reference}
Let $X$ be an integral scheme. An {\it alteration of $X$}
is a proper dominant morphism $f : Y \to X$ with $Y$ integral such
that $f^{-1}(U) \to U$ is finite for some nonempty open $U \subset X$.
\end{definition}

\noindent
This is the definition as given in \cite{alterations}, except that
here we do not require $X$ and $Y$ to be Noetherian. Arguing as above
we see that an alteration is a proper dominant morphism $f : Y \to X$
of integral schemes which induces a finite extension of
function fields, i.e., such that the equivalent conditions of
Lemma \ref{lemma-finite-degree} hold.



\section{The dimension formula}
\label{section-dimension-formula}

\noindent
For morphisms between Noetherian schemes we can say a little more
about dimensions of local rings. Here is an important (and not so
hard to prove) result. Recall that $R(X)$ denotes the function field
of an integral scheme $X$.

\begin{lemma}
\label{lemma-dimension-formula}
Let $S$ be a scheme.
Let $f : X \to S$ be a morphism of schemes.
Let $x \in X$, and set $s = f(x)$.
Assume
\begin{enumerate}
\item $S$ is locally Noetherian,
\item $f$ is locally of finite type,
\item $X$ and $S$ integral, and
\item $f$ dominant.
\end{enumerate}
We have
\begin{equation}
\label{equation-dimension-formula}
\dim(\mathcal{O}_{X, x})
\leq
\dim(\mathcal{O}_{S, s}) + \text{trdeg}_{R(S)}R(X)
- \text{trdeg}_{\kappa(s)} \kappa(x).
\end{equation}
Moreover, equality holds if $S$ is universally catenary.
\end{lemma}

\begin{proof}
The corresponding algebra statement is
Algebra, Lemma \ref{algebra-lemma-dimension-formula}.
\end{proof}

\begin{lemma}
\label{lemma-dimension-formula-general}
Let $S$ be a scheme. Let $f : X \to S$ be a morphism of schemes.
Let $x \in X$, and set $s = f(x)$. Assume $S$ is locally Noetherian
and $f$ is locally of finite type,
We have
\begin{equation}
\label{equation-dimension-formula-general}
\dim(\mathcal{O}_{X, x})
\leq
\dim(\mathcal{O}_{S, s}) + E - \text{trdeg}_{\kappa(s)} \kappa(x).
\end{equation}
where $E$ is the maximum of $\text{trdeg}_{\kappa(f(\xi))}(\kappa(\xi))$
where $\xi$ runs over the generic points of irreducible components
of $X$ containing $x$.
\end{lemma}

\begin{proof}
Let $X_1, \ldots, X_n$ be the irreducible components of $X$ containing $x$
endowed with their reduced induced scheme structure.
These correspond to the minimal primes $\mathfrak q_i$ of
$\mathcal{O}_{X, x}$ and hence there are finitely many of them
(Schemes, Lemma \ref{schemes-lemma-specialize-points} and
Algebra, Lemma \ref{algebra-lemma-Noetherian-irreducible-components}).
Then
$\dim(\mathcal{O}_{X, x}) = \max \dim(\mathcal{O}_{X, x}/\mathfrak q_i)
= \max \dim(\mathcal{O}_{X_i, x})$.
The $\xi$'s occurring in the definition of $E$ are exactly the
generic points $\xi_i \in X_i$. Let $Z_i = \overline{\{f(\xi_i)\}} \subset S$
endowed with the reduced induced scheme structure.
The composition $X_i \to X \to S$ factors through $Z_i$
(Schemes, Lemma \ref{schemes-lemma-map-into-reduction}). Thus we may apply
the dimension formula (Lemma \ref{lemma-dimension-formula})
to see that
$\dim(\mathcal{O}_{X_i, x}) \leq \dim(\mathcal{O}_{Z_i, x}) +
\text{trdeg}_{\kappa(f(\xi))}(\kappa(\xi)) -
\text{trdeg}_{\kappa(s)} \kappa(x)$. Putting everything together
we obtain the lemma.
\end{proof}

\noindent
An application is the construction of a dimension function
on any scheme of finite type over a universally catenary
scheme endowed with a dimension function. For the definition
of dimension functions, see
Topology, Definition \ref{topology-definition-dimension-function}.

\begin{lemma}
\label{lemma-dimension-function-propagates}
Let $S$ be a locally Noetherian and universally catenary scheme.
Let $\delta : S \to \mathbf{Z}$ be a dimension function.
Let $f : X \to S$ be a morphism of schemes.
Assume $f$ locally of finite type.
Then the map
\begin{align*}
\delta = \delta_{X/S} : X & \longrightarrow \mathbf{Z} \\
x & \longmapsto \delta(f(x)) + \text{trdeg}_{\kappa(f(x))} \kappa(x)
\end{align*}
is a dimension function on $X$.
\end{lemma}

\begin{proof}
Let $f : X \to S$ be locally of finite type.
Let $x \leadsto y$, $x \not = y$ be a specialization in $X$.
We have to show that $\delta_{X/S}(x) > \delta_{X/S}(y)$ and
that $\delta_{X/S}(x) = \delta_{X/S}(y) + 1$ if $y$ is an
immediate specialization of $x$.

\medskip\noindent
Choose an affine open $V \subset S$ containing the image of
$y$ and choose an affine open $U \subset X$ mapping into $V$
and containing $y$. We may clearly replace $X$ by $U$ and
$S$ by $V$. Thus we may assume that $X = \Spec(A)$
and $S = \Spec(R)$ and that $f$ is given by a ring
map $R \to A$. The ring $R$ is universally catenary
(Lemma \ref{lemma-universally-catenary-local})
and the map $R \to A$ is of finite type
(Lemma \ref{lemma-locally-finite-type-characterize}).

\medskip\noindent
Let $\mathfrak q \subset A$ be the prime ideal corresponding
to the point $x$ and let $\mathfrak p \subset R$ be the prime
ideal corresponding to $f(x)$. The restriction $\delta'$ of $\delta$
to $S' = \Spec(R/\mathfrak p) \subset S$ is a dimension
function. The ring $R/\mathfrak p$ is universally catenary.
The restriction of $\delta_{X/S}$ to $X' = \Spec(A/\mathfrak q)$
is clearly equal to the function $\delta_{X'/S'}$ constructed
using the dimension function $\delta'$. Hence we may assume
in addition to the above that $R \subset A$ are domains, in
other words that $X$ and $S$ are integral schemes, and that
$x$ is the generic point of $X$ and $f(x)$ is the generic point of $S$.

\medskip\noindent
Note that $\mathcal{O}_{X, x} = R(X)$ and that since $x \leadsto y$,
$x \not = y$, the spectrum of $\mathcal{O}_{X, y}$ has at least
two points
(Schemes, Lemma \ref{schemes-lemma-specialize-points})
hence $\dim(\mathcal{O}_{X, y}) > 0$ .
If $y$ is an immediate specialization of $x$, then
$\Spec(\mathcal{O}_{X, y}) = \{x, y\}$ and
$\dim(\mathcal{O}_{X, y}) = 1$.

\medskip\noindent
Write $s = f(x)$ and $t = f(y)$. We compute
\begin{align*}
\delta_{X/S}(x) - \delta_{X/S}(y)
& =
\delta(s) + \text{trdeg}_{\kappa(s)} \kappa(x)
- \delta(t) - \text{trdeg}_{\kappa(t)} \kappa(y) \\
& =
\delta(s) - \delta(t) +
\text{trdeg}_{R(S)} R(X) - \text{trdeg}_{\kappa(t)} \kappa(y) \\
& =
\delta(s) - \delta(t) + \dim(\mathcal{O}_{X, y})
- \dim(\mathcal{O}_{S, t})
\end{align*}
where we use equality in (\ref{equation-dimension-formula}) in
the last step. Since $\delta$ is a dimension function on the scheme $S$
and $s \in S$ is the generic point, the difference
$\delta(s) - \delta(t)$ is equal to $\text{codim}(\overline{\{t\}}, S)$ by
Topology, Lemma \ref{topology-lemma-dimension-function-catenary}.
This is equal to $\dim(\mathcal{O}_{S, t})$ by
Properties, Lemma
\ref{properties-lemma-codimension-local-ring}.
Hence we conclude that
$$
\delta_{X/S}(x) - \delta_{X/S}(y) = \dim(\mathcal{O}_{X, y})
$$
and the lemma follows from what we said above about $\dim(\mathcal{O}_{X, y})$.
\end{proof}

\noindent
Another application of the dimension formula is that the dimension does not
change under ``alterations'' (to be defined later).

\begin{lemma}
\label{lemma-alteration-dimension}
Let $f : X \to Y$ be a morphism of schemes. Assume that
\begin{enumerate}
\item $Y$ is locally Noetherian,
\item $X$ and $Y$ are integral schemes,
\item $f$ is dominant, and
\item $f$ is locally of finite type.
\end{enumerate}
Then we have
$$
\dim(X) \leq \dim(Y) + \text{trdeg}_{R(Y)} R(X).
$$
If $f$ is closed\footnote{For example if $f$ is proper, see
Definition \ref{definition-proper}.} then equality holds.
\end{lemma}

\begin{proof}
Let $f : X \to Y$ be as in the lemma.
Let $\xi_0 \leadsto \xi_1 \leadsto \ldots \leadsto \xi_e$ be
a sequence of specializations in $X$. Set $x = \xi_e$
and $y = f(x)$. Observe that $e \leq \dim(\mathcal{O}_{X, x})$
as the given specializations occur in the spectrum of
$\mathcal{O}_{X, x}$, see Schemes, Lemma \ref{schemes-lemma-specialize-points}.
By the dimension formula, Lemma \ref{lemma-dimension-formula},
we see that
\begin{align*}
e & \leq \dim(\mathcal{O}_{X, x}) \\
& \leq \dim(\mathcal{O}_{Y, y}) +
\text{trdeg}_{R(Y)} R(X) - \text{trdeg}_{\kappa(y)} \kappa(x) \\
& \leq \dim(\mathcal{O}_{Y, y}) + \text{trdeg}_{R(Y)} R(X)
\end{align*}
Hence we conclude that $e \leq \dim(Y) + \text{trdeg}_{R(Y)} R(X)$ as desired.

\medskip\noindent
Next, assume $f$ is also closed.
Say $\overline{\xi}_0 \leadsto \overline{\xi}_1 \leadsto \ldots
\leadsto \overline{\xi}_d$ is a sequence of specializations in $Y$.
We want to show that $\dim(X) \geq d + r$.
We may assume that $\overline{\xi}_0 = \eta$ is the generic point of $Y$.
The generic fibre $X_\eta$ is a scheme locally of finite type over
$\kappa(\eta) = R(Y)$. It is nonempty as $f$ is dominant. Hence by
Lemma \ref{lemma-ubiquity-Jacobson-schemes} it is a Jacobson scheme.
Thus by Lemma \ref{lemma-jacobson-finite-type-points}
we can find a closed point $\xi_0 \in X_\eta$ and the extension
$\kappa(\eta) \subset \kappa(\xi_0)$ is
a finite extension. Note that
$\mathcal{O}_{X, \xi_0} = \mathcal{O}_{X_\eta, \xi_0}$ because
$\eta$ is the generic point of $Y$. Hence we see that
$\dim(\mathcal{O}_{X, \xi_0}) = r$ by Lemma \ref{lemma-dimension-formula}
applied to the scheme $X_\eta$ over the universally catenary
scheme $\Spec(\kappa(\eta))$ (see Lemma \ref{lemma-ubiquity-uc})
and the point $\xi_0$. This means that we can find
$\xi_{-r} \leadsto \ldots \leadsto \xi_{-1} \leadsto \xi_0$
in $X$. On the other hand, as $f$ is closed specializations
lift along $f$, see
Topology, Lemma \ref{topology-lemma-closed-open-map-specialization}.
Thus, as $\xi_0$ lies
over $\eta = \overline{\xi}_0$ we can
find specializations $\xi_0 \leadsto \xi_1 \leadsto \ldots \leadsto \xi_d$
lying over $\overline{\xi}_0 \leadsto \overline{\xi}_1 \leadsto \ldots
\leadsto \overline{\xi}_d$. In other words we have
$$
\xi_{-r} \leadsto \ldots \leadsto \xi_{-1} \leadsto \xi_0
\leadsto \xi_1 \leadsto \ldots \leadsto \xi_d
$$
which means that $\dim(X) \geq d + r$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-alteration-dimension-general}
Let $f : X \to Y$ be a morphism of schemes. Assume that
$Y$ is locally Noetherian and $f$ is locally of finite type.
Then
$$
\dim(X) \leq \dim(Y) + E
$$
where $E$ is the supremum of $\text{trdeg}_{\kappa(f(\xi))}(\kappa(\xi))$
where $\xi$ runs through the generic points of the irreducible components
of $X$.
\end{lemma}

\begin{proof}
Immediate consequence of Lemma \ref{lemma-dimension-formula-general}
and Properties, Lemma \ref{properties-lemma-dimension}.
\end{proof}








\section{Relative normalization}
\label{section-normalization-X-in-Y}

\noindent
In this section we construct the {\it normalization of one scheme in another}.

\begin{lemma}
\label{lemma-integral-closure}
Let $X$ be a scheme. Let $\mathcal{A}$ be a quasi-coherent sheaf
of $\mathcal{O}_X$-algebras. The subsheaf $\mathcal{A}' \subset \mathcal{A}$
defined by the rule
$$
U \longmapsto \{f \in \mathcal{A}(U) \mid
f_x \in \mathcal{A}_x \text{ integral over } \mathcal{O}_{X, x}
\text{ for all }x \in U\}
$$
is a quasi-coherent $\mathcal{O}_X$-algebra, the stalk $\mathcal{A}'_x$
is the integral closure of $\mathcal{O}_{X, x}$ in $\mathcal{A}_x$, and
for any affine open $U \subset X$ the ring
$\mathcal{A}'(U) \subset \mathcal{A}(U)$ is
the integral closure of $\mathcal{O}_X(U)$ in $\mathcal{A}(U)$.
\end{lemma}

\begin{proof}
This is a subsheaf by the local nature of the conditions.
It is an $\mathcal{O}_X$-algebra by
Algebra, Lemma \ref{algebra-lemma-integral-closure-is-ring}.
Let $U \subset X$ be an affine open. Say $U = \Spec(R)$
and say $\mathcal{A}$ is the quasi-coherent sheaf associated to
the $R$-algebra $A$. Then according to
Algebra, Lemma \ref{algebra-lemma-integral-closure-stalks}
the value of $\mathcal{A}'$ over $U$ is given by the integral
closure $A'$ of $R$ in $A$. This proves the last assertion of
the lemma. To prove that $\mathcal{A}'$ is quasi-coherent, it
suffices to show that $\mathcal{A}'(D(f)) = A'_f$. This follows
from the fact that integral closure and localization commute, see
Algebra, Lemma \ref{algebra-lemma-integral-closure-localize}.
The same fact shows that the stalks are as advertised.
\end{proof}

\begin{definition}
\label{definition-integral-closure}
Let $X$ be a scheme. Let $\mathcal{A}$ be a quasi-coherent sheaf
of $\mathcal{O}_X$-algebras. The {\it integral closure of $\mathcal{O}_X$
in $\mathcal{A}$} is the quasi-coherent $\mathcal{O}_X$-subalgebra
$\mathcal{A}' \subset \mathcal{A}$ constructed in
Lemma \ref{lemma-integral-closure} above.
\end{definition}

\noindent
In the setting of the definition above we can consider the morphism
of relative spectra
$$
\xymatrix{
Y = \underline{\Spec}_X(\mathcal{A}) \ar[rr] \ar[rd] & &
X' = \underline{\Spec}_X(\mathcal{A}') \ar[ld] \\
& X &
}
$$
see Lemma \ref{lemma-affine-equivalence-algebras}.
The scheme $X' \to X$ will be the normalization of $X$ in the scheme $Y$.
Here is a slightly more general setting. Suppose we have a
quasi-compact and quasi-separated morphism $f : Y \to X$
of schemes. In this case the sheaf of
$\mathcal{O}_X$-algebras $f_*\mathcal{O}_Y$ is quasi-coherent, see
Schemes, Lemma \ref{schemes-lemma-push-forward-quasi-coherent}.
Taking the integral closure $\mathcal{O}' \subset f_*\mathcal{O}_Y$
we obtain a quasi-coherent sheaf of $\mathcal{O}_X$-algebras
whose relative spectrum is the normalization of $X$ in $Y$. Here is
the formal definition.

\begin{definition}
\label{definition-normalization-X-in-Y}
Let $f : Y \to X$ be a quasi-compact and quasi-separated morphism of schemes.
Let $\mathcal{O}'$ be the integral closure of $\mathcal{O}_X$ in
$f_*\mathcal{O}_Y$. The {\it normalization of $X$ in $Y$} is the
scheme\footnote{The scheme $X'$ need not be normal, for example if
$Y = X$ and $f = \text{id}_X$, then $X' = X$.}
$$
\nu : X' = \underline{\Spec}_X(\mathcal{O}') \to X
$$
over $X$. It comes equipped with a natural factorization
$$
Y \xrightarrow{f'} X' \xrightarrow{\nu} X
$$
of the initial morphism $f$.
\end{definition}

\noindent
The factorization is the composition of the canonical morphism
$Y \to \underline{\Spec}_X(f_*\mathcal{O}_Y)$ (see
Constructions, Lemma
\ref{constructions-lemma-canonical-morphism})
and the morphism of relative spectra coming from the inclusion map
$\mathcal{O}' \to f_*\mathcal{O}_Y$. We can characterize the
normalization as follows.

\begin{lemma}
\label{lemma-characterize-normalization}
Let $f : Y \to X$ be a quasi-compact and quasi-separated morphism of schemes.
The factorization $f = \nu \circ f'$, where $\nu : X' \to X$ is the
normalization of $X$ in $Y$ is characterized by the following
two properties:
\begin{enumerate}
\item the morphism $\nu$ is integral, and
\item for any factorization $f = \pi \circ g$, with $\pi : Z \to X$
integral, there exists a commutative diagram
$$
\xymatrix{
Y \ar[d]_{f'} \ar[r]_g & Z \ar[d]^\pi \\
X' \ar[ru]^h \ar[r]^\nu & X
}
$$
for some unique morphism $h : X' \to Z$.
\end{enumerate}
Moreover, the morphism $f' : Y \to X'$ is dominant and in (2) the
morphism $h : X' \to Z$ is the normalization of $Z$ in $Y$.
\end{lemma}

\begin{proof}
Let $\mathcal{O}' \subset f_*\mathcal{O}_Y$ be the integral closure of
$\mathcal{O}_X$ as in Definition \ref{definition-normalization-X-in-Y}.
The morphism $\nu$ is integral by construction, which proves (1).
Assume given a factorization $f = \pi \circ g$ with $\pi : Z \to X$
integral as in (2). By Definition \ref{definition-integral}
$\pi$ is affine, and hence $Z$ is the relative
spectrum of a quasi-coherent sheaf of $\mathcal{O}_X$-algebras $\mathcal{B}$.
The morphism $g : Y \to Z$ corresponds to a map of $\mathcal{O}_X$-algebras
$\chi : \mathcal{B} \to f_*\mathcal{O}_Y$. Since $\mathcal{B}(U)$ is
integral over $\mathcal{O}_X(U)$ for every affine open $U \subset X$
(by Definition \ref{definition-integral})
we see from Lemma \ref{lemma-integral-closure}
that $\chi(\mathcal{B}) \subset \mathcal{O}'$.
By the functoriality of the relative spectrum
Lemma \ref{lemma-affine-equivalence-algebras}
this provides us with a unique morphism
$h : X' \to Z$. We omit the verification that the diagram commutes.

\medskip\noindent
It is clear that (1) and (2) characterize the factorization $f = \nu \circ f'$
since it characterizes it as an initial object in a category.

\medskip\noindent
From the universal property in (2) we see that $f'$ does not factor through
a proper closed subscheme of $X'$. Hence the scheme theoretic image of $f'$
is $X'$. Since $f'$ is quasi-compact (by Schemes, Lemma
\ref{schemes-lemma-quasi-compact-permanence} and the fact that $\nu$ is
separated as an affine morphism) we see that $f'(Y)$ is dense in $X'$.
Hence $f'$ is dominant.

\medskip\noindent
Observe that $g$ is quasi-compact and quasi-separated by
Schemes, Lemmas \ref{schemes-lemma-compose-after-separated} and
\ref{schemes-lemma-quasi-compact-permanence}. Thus the last statement
of the lemma makes sense.
The morphism $h$ in (2) is integral by Lemma \ref{lemma-finite-permanence}.
Given a factorization $g = \pi' \circ g'$ with $\pi' : Z' \to Z$
integral, we get a factorization $f = (\pi \circ \pi') \circ g'$ and
we get a morphism $h' : X' \to Z'$. Uniqueness implies that
$\pi' \circ h' = h$. Hence the characterization (1), (2) applies
to the morphism $h : X' \to Z$ which gives the final assertion of the lemma.
\end{proof}

\begin{lemma}
\label{lemma-functoriality-normalization}
Let
$$
\xymatrix{
Y_2 \ar[d]_{f_2} \ar[r] & Y_1 \ar[d]^{f_1} \\
X_2 \ar[r] & X_1
}
$$
be a commutative diagram of morphisms of schemes.
Assume $f_1$, $f_2$ quasi-compact and quasi-separated.
Let $f_i = \nu_i \circ f_i'$, $i = 1, 2$
be the canonical factorizations, where $\nu_i : X_i' \to X_i$ is
the normalization of $X_i$ in $Y_i$. Then there exists a unique
arrow $X'_2 \to X'_1$ fitting into a
commutative diagram
$$
\xymatrix{
Y_2 \ar[d]_{f_2'} \ar[r] & Y_1 \ar[d]^{f_1'} \\
X_2' \ar[d]_{\nu_2} \ar[r] & X_1' \ar[d]^{\nu_1} \\
X_2 \ar[r] & X_1
}
$$
\end{lemma}

\begin{proof}
By Lemmas \ref{lemma-characterize-normalization} (1)
and \ref{lemma-base-change-finite}
the base change $X_2 \times_{X_1} X'_1 \to X_2$
is integral. Note that $f_2$ factors through this morphism.
Hence we get a unique morphism
$X'_2 \to X_2 \times_{X_1} X'_1$ from
Lemma \ref{lemma-characterize-normalization} (2).
This gives the arrow $X'_2 \to X'_1$ fitting into
the commutative diagram and uniqueness follows as well.
\end{proof}

\begin{lemma}
\label{lemma-normalization-localization}
Let $f : Y \to X$ be a quasi-compact and quasi-separated morphism of schemes.
Let $U \subset X$ be an open subscheme and set $V = f^{-1}(U)$.
Then the normalization of $U$ in $V$ is the inverse image of $U$
in the normalization of $X$ in $Y$.
\end{lemma}

\begin{proof}
Clear from the construction.
\end{proof}

\begin{lemma}
\label{lemma-normalization-is-normalization}
Let $f : Y \to X$ be a quasi-compact and quasi-separated morphism of schemes.
Let $X'$ be the normalization of $X$ in $Y$. Then the normalization of
$X'$ in $Y$ is $X'$.
\end{lemma}

\begin{proof}
If $Y \to X'' \to X'$ is the normalization of $X'$ in $Y$, then
we can apply Lemma \ref{lemma-characterize-normalization}
to the composition $X'' \to X$ to get a canonical morphism
$h : X' \to X''$ over $X$. We omit the verification that the
morphisms $h$ and $X'' \to X'$ are mutually inverse (using uniqueness
of the factorization in the lemma).
\end{proof}

\begin{lemma}
\label{lemma-normalization-in-reduced}
Let $f : Y \to X$ be a quasi-compact and quasi-separated morphism of schemes.
Let $X' \to X$ be the normalization of $X$ in $Y$. If $Y$ is reduced, so
is $X'$.
\end{lemma}

\begin{proof}
This follows from the fact that a subring of a reduced ring is reduced.
Some details omitted.
\end{proof}

\begin{lemma}
\label{lemma-normalization-generic}
Let $f : Y \to X$ be a quasi-compact and quasi-separated morphism of schemes.
Let $X' \to X$ be the normalization of $X$ in $Y$. Every generic point of
an irreducible component of $X'$ is the image of a generic point of
an irreducible component of $Y$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-normalization-localization} we may assume $X = \Spec(A)$
is affine. Choose a finite affine open covering $Y = \bigcup \Spec(B_i)$.
Then $X' = \Spec(A')$ and the morphisms $\Spec(B_i) \to Y \to X'$
jointly define an injective $A$-algebra map $A' \to \prod B_i$.
Thus the lemma follows from
Algebra, Lemma \ref{algebra-lemma-injective-minimal-primes-in-image}.
\end{proof}

\begin{lemma}
\label{lemma-normalization-in-disjoint-union}
Let $f : Y \to X$ be a quasi-compact and quasi-separated morphism of schemes.
Suppose that $Y = Y_1 \amalg Y_2$ is a disjoint union of two schemes.
Write $f_i = f|_{Y_i}$. Let $X_i'$ be the normalization of $X$ in $Y_i$.
Then $X_1' \amalg X_2'$ is the normalization of $X$ in $Y$.
\end{lemma}

\begin{proof}
In terms of integral closures this corresponds to the following fact:
Let $A \to B$ be a ring map. Suppose that $B = B_1 \times B_2$.
Let $A_i'$ be the integral closure of $A$ in $B_i$. Then
$A_1' \times A_2'$ is the integral closure of $A$ in $B$.
The reason this works is that the elements $(1, 0)$ and $(0, 1)$ of $B$
are idempotents and hence integral over $A$. Thus the integral closure
$A'$ of $A$ in $B$ is a product and it is not hard to see that the factors
are the integral closures $A'_i$ as described above (some details
omitted).
\end{proof}

\begin{lemma}
\label{lemma-normalization-in-universally-closed}
Let $f : X \to S$ be a quasi-compact, quasi-separated and
universally closed morphisms of schemes.
Then $f_*\mathcal{O}_X$ is integral over $\mathcal{O}_S$. In other
words, the normalization of $S$ in $X$ is equal to the factorization
$$
X \longrightarrow \underline{\Spec}_S(f_*\mathcal{O}_X)
\longrightarrow S
$$
of Constructions, Lemma \ref{constructions-lemma-canonical-morphism}.
\end{lemma}

\begin{proof}
The question is local on $S$, hence we may assume $S = \Spec(R)$
is affine. Let $h \in \Gamma(X, \mathcal{O}_X)$. We have to show that
$h$ satisfies a monic equation over $R$. Think of $h$ as a morphism
as in the following commutative diagram
$$
\xymatrix{
X \ar[rr]_h \ar[rd]_f & & \mathbf{A}^1_S \ar[ld] \\
& S &
}
$$
Let $Z \subset \mathbf{A}^1_S$ be the scheme theoretic image of $h$,
see Definition \ref{definition-scheme-theoretic-image}.
The morphism $h$ is quasi-compact as $f$ is quasi-compact and
$\mathbf{A}^1_S \to S$ is separated, see
Schemes, Lemma \ref{schemes-lemma-quasi-compact-permanence}.
By Lemma \ref{lemma-quasi-compact-scheme-theoretic-image} the
morphism $X \to Z$ is dominant. By
Lemma \ref{lemma-image-proper-scheme-closed} the morphism
$X \to Z$ is closed. Hence $h(X) = Z$ (set theoretically).
Thus we can use
Lemma \ref{lemma-image-proper-is-proper}
to conclude that $Z \to S$ is universally closed (and even proper).
Since $Z \subset \mathbf{A}^1_S$, we see that $Z \to S$ is affine
and proper, hence integral by Lemma \ref{lemma-integral-universally-closed}.
Writing $\mathbf{A}^1_S = \Spec(R[T])$ we conclude that
the ideal $I \subset R[T]$ of $Z$ contains a monic polynomial
$P(T) \in R[T]$. Hence $P(h) = 0$ and we win.
\end{proof}

\begin{lemma}
\label{lemma-normalization-in-integral}
Let $f : Y \to X$ be an integral morphism.
Then the normalization of $X$ in $Y$ is equal to $Y$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-integral-universally-closed} this is a special case of
Lemma \ref{lemma-normalization-in-universally-closed}.
\end{proof}

\begin{lemma}
\label{lemma-normal-normalization}
Let $f : Y \to X$ be a quasi-compact and quasi-separated morphism
of schemes. Let $X'$ be the normalization of $X$ in $Y$. Assume
\begin{enumerate}
\item $Y$ is a normal scheme,
\item quasi-compact opens of $Y$ have finitely many irreducible components.
\end{enumerate}
Then $X'$ is a disjoint union of integral normal schemes. Moreover,
the morphism $Y \to X'$ is dominant and induces a bijection of
irreducible components.
\end{lemma}

\begin{proof}
Let $U \subset X$ be an affine open. Consider the
inverse image $U'$ of $U$ in $X'$.
Set $V = f^{-1}(U)$. By Lemma \ref{lemma-normalization-localization}
we $V \to U' \to U$ is the normalization of $U$ in $V$. Say
$U = \Spec(A)$. Then $V$ is quasi-compact, and hence has a finite number of
irreducible components by assumption. Hence
$V = \coprod_{i = 1, \ldots n} V_i$ is a finite disjoint union of
normal integral schemes by
Properties, Lemma \ref{properties-lemma-normal-locally-finite-nr-irreducibles}.
By Lemma \ref{lemma-normalization-in-disjoint-union}
we see that $U' = \coprod_{i = 1, \ldots, n} U_i'$,
where $U'_i$ is the normalization of $U$ in $V_i$.
By Properties, Lemma \ref{properties-lemma-normal-integral-sections}
we see that $B_i = \Gamma(V_i, \mathcal{O}_{V_i})$ is a normal domain.
Note that $U_i' = \Spec(A_i')$, where $A_i' \subset B_i$
is the integral closure of $A$ in $B_i$, see
Lemma \ref{lemma-integral-closure}. By
Algebra, Lemma \ref{algebra-lemma-integral-closure-in-normal}
we see that $A_i' \subset B_i$ is a normal domain.
Hence $U' = \coprod U_i'$ is a finite union of normal integral schemes
and hence is normal.

\medskip\noindent
As $X'$ has an open covering by the schemes $U'$ we conclude from
Properties, Lemma \ref{properties-lemma-locally-normal} that $X'$ is normal.
On the other hand, each $U'$ is a finite disjoint union of irreducible
schemes, hence every quasi-compact open of $X'$ has finitely many irreducible
components (by a topological argument which we omit). Thus $X'$
is a disjoint union of normal integral schemes by
Properties, Lemma \ref{properties-lemma-normal-locally-finite-nr-irreducibles}.
It is clear from the description of $X'$ above that $Y \to X'$
is dominant and induces a bijection on irreducible components
$V \to U'$ for every affine open $U \subset X$. The bijection of
irreducible components for the morphism $Y \to X'$
follows from this by a topological argument (omitted).
\end{proof}

\begin{lemma}
\label{lemma-nagata-normalization-finite-general}
Let $f : X \to S$ be a morphism. Assume that
\begin{enumerate}
\item $S$ is a Nagata scheme,
\item $f$ is quasi-compact and quasi-separated,
\item quasi-compact opens of $X$ have finitely many irreducible components,
\item if $x \in X$ is a generic point of an irreducible component,
then the field extension $\kappa(x)/\kappa(f(x))$ is finitely
generated, and
\item $X$ is reduced.
\end{enumerate}
Then the normalization $\nu : S' \to S$ of $S$ in $X$ is finite.
\end{lemma}

\begin{proof}
There is an immediate reduction to the case $S = \Spec(R)$
where $R$ is a Nagata ring by assumption (1). We have to show that
the integral closure $A$ of $R$ in $\Gamma(X, \mathcal{O}_X)$ is
finite over $R$. Since $f$ is quasi-compact by assumption (2) we can write
$X = \bigcup_{i = 1, \ldots, n} U_i$ with each $U_i$ affine.
Say $U_i = \Spec(B_i)$. Each $B_i$ is reduced by assumption (5)
and has finitely many minimal primes
$\mathfrak q_{i1}, \ldots, \mathfrak q_{im_i}$
by assumption (3) and
Algebra, Lemma \ref{algebra-lemma-irreducible}.
We have
$$
\Gamma(X, \mathcal{O}_X) \subset B_1 \times \ldots \times B_n
\subset
\prod\nolimits_{i = 1, \ldots, n}
\prod\nolimits_{j = 1, \ldots, m_i} (B_i)_{\mathfrak q_{ij}}
$$
the second inclusion by
Algebra, Lemma \ref{algebra-lemma-reduced-ring-sub-product-fields}.
We have $\kappa(\mathfrak q_{ij}) = (B_i)_{\mathfrak q_{ij}}$ by
Algebra, Lemma \ref{algebra-lemma-minimal-prime-reduced-ring}.
Hence the integral closure $A$ of $R$ in $\Gamma(X, \mathcal{O}_X)$
is contained in the product of the integral closures $A_{ij}$ of
$R$ in $\kappa(\mathfrak q_{ij})$. Since $R$ is Noetherian
it suffices to show that $A_{ij}$ is a finite $R$-module for each $i, j$.
Let $\mathfrak p_{ij} \subset R$ be the image of $\mathfrak q_{ij}$.
As $\kappa(\mathfrak q_{ij})/\kappa(\mathfrak p_{ij})$
is a finitely generated field extension by assumption (4),
we see that $R \to \kappa(\mathfrak q_{ij})$ is essentially of finite type.
Thus $R \to A_{ij}$ is finite by Algebra, Lemma
\ref{algebra-lemma-nagata-in-reduced-finite-type-finite-integral-closure}.
\end{proof}

\begin{lemma}
\label{lemma-nagata-normalization-finite}
Let $f : X \to S$ be a morphism. Assume that
\begin{enumerate}
\item $S$ is a Nagata scheme,
\item $f$ is of finite type,
\item $X$ is reduced.
\end{enumerate}
Then the normalization $\nu : S' \to S$ of $S$ in $X$ is finite.
\end{lemma}

\begin{proof}
This is a special case of
Lemma \ref{lemma-nagata-normalization-finite-general}.
Namely, (2) holds as the finite type morphism $f$ is quasi-compact
by definition and quasi-separated by
Lemma \ref{lemma-finite-type-Noetherian-quasi-separated}.
Condition (3) holds because $X$ is locally Noetherian by
Lemma \ref{lemma-finite-type-noetherian}. Finally, condition (4)
holds because a finite type morphism induces finitely generated
residue field extensions.
\end{proof}

\begin{lemma}
\label{lemma-relative-normalization-normal-codim-1}
Let $f : Y \to X$ be a finite type morphism of schemes with $Y$ reduced
and $X$ Nagata. Let $X'$ be the normalization of $X$ in $Y$.
Let $x' \in X'$ be a point such that
\begin{enumerate}
\item $\dim(\mathcal{O}_{X', x'}) = 1$, and
\item the fibre of $Y \to X'$ over $x'$ is empty.
\end{enumerate}
Then $\mathcal{O}_{X', x'}$ is a discrete valuation ring.
\end{lemma}

\begin{proof}
We can replace $X$ by an affine neighbourhood of the image of $x'$.
Hence we may assume $X = \Spec(A)$ with $A$ Nagata.
By Lemma \ref{lemma-nagata-normalization-finite}
the morphism $X' \to X$ is finite. Hence we can write
$X' = \Spec(A')$ for a finite $A$-algebra $A'$.
By Lemma \ref{lemma-normalization-is-normalization}
after replacing $X$ by $X'$
we reduce to the case described in the next paragraph.

\medskip\noindent
The case $X = X' = \Spec(A)$ with $A$ Noetherian.
Let $\mathfrak p \subset A$ be the prime ideal
corresponding to our point $x'$. Choose $g \in \mathfrak p$
not contained in any minimal prime of $A$ (use prime avoidance
and the fact that $A$ has finitely many minimal primes, see
Algebra, Lemmas \ref{algebra-lemma-silly} and
\ref{algebra-lemma-Noetherian-irreducible-components}).
Set $Z = f^{-1}V(g) \subset Y$; it is a closed subscheme of $Y$.
Then $f(Z)$ does not contain any generic point by choice of $g$
and does not contain $x'$ because $x'$ is not in the image of $f$.
The closure of $f(Z)$ is the set of specializations of points
of $f(Z)$ by Lemma \ref{lemma-reach-points-scheme-theoretic-image}.
Thus the closure of $f(Z)$ does not contain $x'$ because
the condition $\dim(\mathcal{O}_{X', x'}) = 1$ implies only
the generic points of $X = X'$ specialize to $x'$.
In other words, after replacing $X$ by an affine open
neighbourhood of $x'$ we may assume that $f^{-1}V(g) = \emptyset$.
Thus $g$ maps to an invertible global function on $Y$ and
we obtain a factorization
$$
A \to A_g \to \Gamma(Y, \mathcal{O}_Y)
$$
Since $X = X'$ this implies that $A$ is equal to the integral
closure of $A$ in $A_g$. By
Algebra, Lemma \ref{algebra-lemma-integral-closure-localize}
we conclude that $A_\mathfrak p$ is the integral closure
of $A_\mathfrak p$ in $A_\mathfrak p[1/g]$.
By our choice of $g$, since $\dim(A_\mathfrak p) = 1$
and since $A$ is reduced we see that $A_\mathfrak p[1/g]$
is a finite product of fields (the product of the residue fields
of the minimal primes contained in $\mathfrak p$). Hence $A_\mathfrak p$ is
normal (Algebra, Lemma \ref{algebra-lemma-characterize-reduced-ring-normal})
and the proof is complete. Some details omitted.
\end{proof}






\section{Normalization}
\label{section-normalization}

\noindent
Next, we come to the normalization of a scheme $X$.
We only define/construct it when $X$ has locally finitely many irreducible
components. Let $X$ be a scheme such that every quasi-compact open has
finitely many irreducible components. Let
$X^{(0)} \subset X$ be the set of generic points of irreducible components
of $X$. Let
\begin{equation}
\label{equation-generic-points}
f :
Y = \coprod\nolimits_{\eta \in X^{(0)}} \Spec(\kappa(\eta))
\longrightarrow
X
\end{equation}
be the inclusion of the generic points into $X$ using the
canonical maps of Schemes, Section \ref{schemes-section-points}.
Note that this morphism is quasi-compact by assumption and
quasi-separated as $Y$ is separated (see
Schemes, Section \ref{schemes-section-separation-axioms}).

\begin{definition}
\label{definition-normalization}
Let $X$ be a scheme such that every quasi-compact open has
finitely many irreducible components. We define the
{\it normalization} of $X$ as the morphism
$$
\nu : X^\nu \longrightarrow X
$$
which is the normalization of $X$ in the morphism $f : Y \to X$
(\ref{equation-generic-points}) constructed above.
\end{definition}

\noindent
Any locally Noetherian scheme has a locally finite set of irreducible
components and the definition applies to it.
Usually the normalization is defined only for reduced schemes.
With the definition above the normalization of $X$ is the same
as the normalization of the reduction $X_{red}$ of $X$.

\begin{lemma}
\label{lemma-normalization-reduced}
Let $X$ be a scheme such that every quasi-compact open has
finitely many irreducible components. The normalization morphism
$\nu$ factors through the reduction $X_{red}$ and $X^\nu \to X_{red}$
is the normalization of $X_{red}$.
\end{lemma}

\begin{proof}
Let $f : Y \to X$ be the morphism (\ref{equation-generic-points}).
We get a factorization $Y \to X_{red} \to X$ of $f$ from
Schemes, Lemma \ref{schemes-lemma-map-into-reduction}.
By Lemma \ref{lemma-characterize-normalization} we obtain a canonical
morphism $X^\nu \to X_{red}$
and that $X^\nu$ is the normalization of $X_{red}$ in $Y$.
The lemma follows as $Y \to X_{red}$ is identical to the morphism
(\ref{equation-generic-points}) constructed for $X_{red}$.
\end{proof}

\noindent
If $X$ is reduced, then the normalization of $X$ is the same
as the relative spectrum of the integral closure of $\mathcal{O}_X$
in the sheaf of meromorphic functions $\mathcal{K}_X$
(see Divisors, Section \ref{divisors-section-meromorphic-functions}).
Namely, $\mathcal{K}_X = f_*\mathcal{O}_Y$ in this case, see
Divisors, Lemma \ref{divisors-lemma-reduced-finite-irreducible}
and its proof. We describe this here explicitly.

\begin{lemma}
\label{lemma-description-normalization}
Let $X$ be a reduced scheme such that every quasi-compact open has
finitely many irreducible components. Let $\Spec(A) = U \subset X$
be an affine open. Then
\begin{enumerate}
\item $A$ has finitely many minimal primes
$\mathfrak q_1, \ldots, \mathfrak q_t$,
\item the total ring of fractions $Q(A)$ of $A$ is
$Q(A/\mathfrak q_1) \times \ldots \times Q(A/\mathfrak q_t)$,
\item the integral closure $A'$ of $A$ in $Q(A)$ is the product of
the integral closures of the domains $A/\mathfrak q_i$
in the fields $Q(A/\mathfrak q_i)$, and
\item $\nu^{-1}(U)$ is identified with the spectrum of $A'$ where
$\nu : X^\nu \to X$ is the normalization morphism.
\end{enumerate}
\end{lemma}

\begin{proof}
Minimal primes correspond to irreducible components
(Algebra, Lemma \ref{algebra-lemma-irreducible}),
hence we have (1) by assumption. Then
$(0) = \mathfrak q_1 \cap \ldots \cap \mathfrak q_t$ because $A$ is reduced
(Algebra, Lemma \ref{algebra-lemma-Zariski-topology}).
Then we have
$Q(A) = \prod A_{\mathfrak q_i} = \prod \kappa(\mathfrak q_i)$
by Algebra, Lemmas \ref{algebra-lemma-total-ring-fractions-no-embedded-points}
and \ref{algebra-lemma-minimal-prime-reduced-ring}.
This proves (2). Part (3) follows from
Algebra, Lemma \ref{algebra-lemma-characterize-reduced-ring-normal},
or Lemma \ref{lemma-normalization-in-disjoint-union}.
Part (4) holds because it is clear that $f^{-1}(U) \to U$ is the morphism
$$
\Spec\left(\prod \kappa(\mathfrak q_i)\right)
\longrightarrow
\Spec(A)
$$
where $f : Y \to X$ is the morphism (\ref{equation-generic-points}).
\end{proof}

\begin{lemma}
\label{lemma-stalk-normalization}
Let $X$ be a scheme such that every quasi-compact open has a finite
number of irreducible components. Let $\nu : X^\nu \to X$
be the normalization of $X$. Let $x \in X$. Then the following
are canonically isomorphic as $\mathcal{O}_{X, x}$-algebras
\begin{enumerate}
\item the stalk $(\nu_*\mathcal{O}_{X^\nu})_x$,
\item the integral closure of $\mathcal{O}_{X, x}$ in
the total ring of fractions of $(\mathcal{O}_{X, x})_{red}$,
\item the integral closure of $\mathcal{O}_{X, x}$ in the product
of the residue fields of the minimal primes of $\mathcal{O}_{X, x}$
(and there are finitely many of these).
\end{enumerate}
\end{lemma}

\begin{proof}
After replacing $X$ by an affine open neighbourhood
of $x$ we may assume that $X$ has finitely many irreducible
components and that $x$ is contained in each of them.
Then the stalk $(\nu_*\mathcal{O}_{X^\nu})_x$ is the
integral closure of $A = \mathcal{O}_{X, x}$ in the product $L$
of the residue fields of the minimal primes of $A$.
This follows from the construction of the normalization and
Lemma \ref{lemma-integral-closure}.
Alternatively, you can use Lemma
\ref{lemma-description-normalization}
and the fact that normalization commutes with localization
(Algebra, Lemma \ref{algebra-lemma-integral-closure-localize}).
Since $A_{red}$ has finitely many minimal primes
(because these correspond exactly to the generic points
of the irreducible components of $X$ passing through $x$)
we see that $L$ is the total ring of fractions of $A_{red}$
(Algebra, Lemma \ref{algebra-lemma-total-ring-fractions-no-embedded-points}).
Thus our ring is also the integral closure of $A$ in the total
ring of fractions of $A_{red}$.
\end{proof}

\begin{lemma}
\label{lemma-normalization-normal}
Let $X$ be a scheme such that every quasi-compact open has
finitely many irreducible components.
\begin{enumerate}
\item The normalization $X^\nu$ is a disjoint union of integral normal schemes.
\item The morphism $\nu : X^\nu \to X$ is integral, surjective, and
induces a bijection on irreducible components.
\item For any integral morphism $\alpha : X' \to X$ such that for
$U \subset X$ quasi-compact open the inverse image $\alpha^{-1}(U)$ has
finitely many irreducible components and
$\alpha|_{\alpha^{-1}(U)} : \alpha^{-1}(U) \to U$ is birational\footnote{This
awkward formulation is necessary as we've only defined what
it means for a morphism to be birational if the source and target
have finitely many irreducible components. It suffices if
$X'_{red} \to X_{red}$ satisfies the condition.}
there exists a factorization
$X^\nu \to X' \to X$ and $X^\nu \to X'$ is the normalization of $X'$.
\item For any morphism $Z \to X$ with $Z$ a normal scheme
such that each irreducible component of $Z$ dominates an irreducible
component of $X$ there exists a unique factorization $Z \to X^\nu \to X$.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $f : Y \to X$ be as in (\ref{equation-generic-points}).
The scheme $X^\nu$ is a disjoint union of normal integral schemes
because $Y$ is normal and every affine open of $Y$ has finitely
many irreducible components, see
Lemma \ref{lemma-normal-normalization}. This proves (1).
Alternatively one can deduce (1) from
Lemmas \ref{lemma-normalization-reduced} and
\ref{lemma-description-normalization}.

\medskip\noindent
The morphism $\nu$ is integral by Lemma \ref{lemma-characterize-normalization}.
By Lemma \ref{lemma-normal-normalization} the
morphism $Y \to X^\nu$ induces a bijection on irreducible components,
and by construction of $Y$ this implies that $X^\nu \to X$ induces
a bijection on irreducible components. By construction $f : Y \to X$
is dominant, hence also $\nu$ is dominant. Since an integral morphism is
closed (Lemma \ref{lemma-integral-universally-closed}) this implies that
$\nu$ is surjective. This proves (2).

\medskip\noindent
Suppose that $\alpha : X' \to X$ is as in (3). It is clear that
$X'$ satisfies the assumptions under which the normalization
is defined. Let $f' : Y' \to X'$ be the morphism
(\ref{equation-generic-points}) constructed starting with $X'$.
As $\alpha$ is locally birational it is clear that
$Y' = Y$ and $f = \alpha \circ f'$.
Hence the factorization $X^\nu \to X' \to X$ exists
and $X^\nu \to X'$ is the normalization of $X'$ by
Lemma \ref{lemma-characterize-normalization}. This proves (3).

\medskip\noindent
Let $g : Z \to X$ be a morphism whose domain is a normal scheme
and such that every irreducible component dominates an irreducible
component of $X$. By Lemma \ref{lemma-normalization-reduced}
we have $X^\nu = X_{red}^\nu$ and by
Schemes, Lemma \ref{schemes-lemma-map-into-reduction}
$Z \to X$ factors through $X_{red}$. Hence we may replace $X$ by
$X_{red}$ and assume $X$ is reduced. Moreover, as the factorization
is unique it suffices to construct it locally on $Z$.
Let $W \subset Z$ and $U \subset X$ be affine opens
such that $g(W) \subset U$. Write $U = \Spec(A)$ and
$W = \Spec(B)$, with $g|_W$ given by $\varphi : A \to B$.
We will use the results of Lemma \ref{lemma-description-normalization} freely.
Let $\mathfrak p_1, \ldots, \mathfrak p_t$ be the minimal primes of $A$.
As $Z$ is normal, we see that $B$ is a normal
ring, in particular reduced. Moreover, by assumption any minimal
prime $\mathfrak q \subset B$ we have that $\varphi^{-1}(\mathfrak q)$
is a minimal prime of $A$. Hence if $x \in A$ is a nonzerodivisor, i.e.,
$x \not \in \bigcup \mathfrak p_i$, then $\varphi(x)$ is a nonzerodivisor
in $B$. Thus we obtain a canonical ring map $Q(A) \to Q(B)$. As $B$ is
normal it is equal to its integral closure in $Q(B)$ (see
Algebra, Lemma \ref{algebra-lemma-normal-ring-integrally-closed}).
Hence we see that the integral closure $A' \subset Q(A)$ of $A$
maps into $B$ via the canonical map $Q(A) \to Q(B)$.
Since $\nu^{-1}(U) = \Spec(A')$ this gives the canonical
factorization $W \to \nu^{-1}(U) \to U$ of $\nu|_W$.
We omit the verification that it is unique.
\end{proof}

\begin{lemma}
\label{lemma-normalization-in-terms-of-components}
Let $X$ be a scheme such that every quasi-compact open has
finitely many irreducible components. Let $Z_i \subset X$, $i \in I$
be the irreducible components of $X$ endowed with the reduced
induced structure. Let $Z_i^\nu \to Z_i$ be the normalization.
Then $\coprod_{i \in I} Z_i^\nu \to X$ is the normalization of $X$.
\end{lemma}

\begin{proof}
We may assume $X$ is reduced, see Lemma \ref{lemma-normalization-reduced}.
Then the lemma follows either from the local description in
Lemma \ref{lemma-description-normalization}
or from Lemma \ref{lemma-normalization-normal} part (3) because
$\coprod Z_i \to X$ is integral and locally birational (as $X$ is reduced
and has locally finitely many irreducible components).
\end{proof}

\begin{lemma}
\label{lemma-normalization-birational}
Let $X$ be a reduced scheme with finitely many irreducible components.
Then the normalization morphism $X^\nu \to X$ is birational.
\end{lemma}

\begin{proof}
The normalization induces a bijection of irreducible components by
Lemma \ref{lemma-normalization-normal}. Let $\eta \in X$ be a generic
point of an irreducible component of $X$ and let $\eta^\nu \in X^\nu$
be the generic point of the corresponding irreducible component of $X^\nu$.
Then $\eta^\nu \mapsto \eta$ and to finish the proof we have to show that
$\mathcal{O}_{X, \eta} \to \mathcal{O}_{X^\nu, \eta^\nu}$
is an isomorphism, see Definition \ref{definition-birational}.
Because $X$ and $X^\nu$ are reduced, we see that both local rings
are equal to their residue fields
(Algebra, Lemma \ref{algebra-lemma-minimal-prime-reduced-ring}).
On the other hand, by the construction of the normalization
as the normalization of $X$ in $Y = \coprod \Spec(\kappa(\eta))$
we see that we have
$\kappa(\eta) \subset \kappa(\eta^\nu) \subset \kappa(\eta)$
and the proof is complete.
\end{proof}

\begin{lemma}
\label{lemma-finite-birational-over-normal}
A finite (or even integral) birational morphism $f : X \to Y$
of integral schemes with $Y$ normal is an isomorphism.
\end{lemma}

\begin{proof}
Let $V \subset Y$ be an affine open
with inverse image $U \subset X$ which is an affine open too.
Since $f$ is a birational morphism of integral schemes, the homomorphism
$\mathcal{O}_Y(V) \to \mathcal{O}_X(U)$ is an injective map of domains
which induces an isomorphism of fraction fields. As $Y$ is normal,
the ring $\mathcal{O}_Y(V)$ is integrally closed in the fraction field.
Since $f$ is finite (or integral) every element of $\mathcal{O}_X(U)$
is integral over $\mathcal{O}_Y(V)$. We conclude that
$\mathcal{O}_Y(V) = \mathcal{O}_X(U)$. This proves that $f$ is an
isomorphism as desired.
\end{proof}

\begin{lemma}
\label{lemma-normalization-trivial}
Let $X$ be a scheme with locally finitely many irreducible components.
The normalization morphism $\nu : X^\nu \to X$ is an isomorphism
if and only if $X$ is normal.
\end{lemma}

\begin{proof}
If $\nu$ is an isomorphism, then $X$ is normal by
Lemma \ref{lemma-normalization-normal}.
Conversely, suppose $X$ is normal.
By Lemma \ref{lemma-normalization-localization} and
Properties, Lemma \ref{properties-lemma-normal-locally-finite-nr-irreducibles}
we may assume $X$ is integral.
By Lemma \ref{lemma-normalization-normal} the morphism
$\nu$ is integral and $X^\nu$ has a unique irreducible component
(so it is an integral scheme).
We conclude from Lemmas \ref{lemma-normalization-birational} and
\ref{lemma-finite-birational-over-normal}.
\end{proof}

\begin{lemma}
\label{lemma-Japanese-normalization}
Let $X$ be an integral, Japanese scheme.
The normalization $\nu : X^\nu \to X$ is a finite morphism.
\end{lemma}

\begin{proof}
Follows from the definition
(Properties, Definition \ref{properties-definition-nagata}) and
Lemma \ref{lemma-description-normalization}. Namely, in this case
the lemma says that $\nu^{-1}(\Spec(A))$ is the spectrum
of the integral closure of $A$ in its field of fractions.
\end{proof}

\begin{lemma}
\label{lemma-nagata-normalization}
Let $X$ be a Nagata scheme.
The normalization $\nu : X^\nu \to X$ is a finite morphism.
\end{lemma}

\begin{proof}
Note that a Nagata scheme is locally Noetherian, thus
Definition \ref{definition-normalization}
does apply. The lemma is now a special case of
Lemma \ref{lemma-nagata-normalization-finite-general}
but we can also prove it directly as follows.
Write $X^\nu \to X$ as the composition
$X^\nu \to X_{red} \to X$. As $X_{red} \to X$ is a closed immersion
it is finite. Hence it suffices to prove the lemma for a reduced
Nagata scheme (by Lemma \ref{lemma-composition-finite}).
Let $\Spec(A) = U \subset X$ be an affine open.
By Lemma \ref{lemma-description-normalization} we have
$\nu^{-1}(U) = \Spec(\prod A_i')$ where $A_i'$ is the integral
closure of $A/\mathfrak q_i$ in its fraction field. As $A$ is a Nagata
ring (see Properties, Lemma \ref{properties-lemma-locally-nagata})
each of the ring extensions
$A/\mathfrak q_i \subset A'_i$ are finite. Hence $A \to \prod A'_i$
is a finite ring map and we win.
\end{proof}

\begin{lemma}
\label{lemma-normalization-geom-unibranch-univ-homeo}
Let $X$ be an irreducible, geometrically unibranch scheme.
The normalization morphism $\nu : X^\nu \to X$ is a universal
homeomorphism.
\end{lemma}

\begin{proof}
We have to show that $\nu$ is integral, universally injective,
and surjective, see Lemma \ref{lemma-universal-homeomorphism}.
By Lemma \ref{lemma-normalization-normal} the morphism $\nu$
is integral. Let $x \in X$ and set $A = \mathcal{O}_{X, x}$.
Since $X$ is irreducible we see that $A$ has a single
minimal prime $\mathfrak p$ and $A_{red} = A/\mathfrak p$.
By Lemma \ref{lemma-stalk-normalization} the stalk
$A' = (\nu_*\mathcal{O}_{X^\nu})_x$ is the integral closure of
$A$ in the fraction field of $A_{red}$. By
More on Algebra, Definition \ref{more-algebra-definition-unibranch}
we see that $A'$ has a single prime $\mathfrak m'$ lying
over $\mathfrak m_x \subset A$ and $\kappa(\mathfrak m')/\kappa(x)$
is purely inseparable. Hence $\nu$ is bijective (hence surjective)
and universally injective by Lemma \ref{lemma-universally-injective}.
\end{proof}







\section{Weak normalization}
\label{section-weak-normalization}

\noindent
We will only define the weak normalization of a scheme when
it locally has finitely many irreducible components; similar
to the case of normalization.

\begin{lemma}
\label{lemma-relative-weak-normalization-algebra}
Let $A \to B$ be a ring map inducing a dominant morphism
$\Spec(B) \to \Spec(A)$ of spectra. There exists an $A$-subalgebra
$B' \subset B$ such that
\begin{enumerate}
\item $\Spec(B') \to \Spec(A)$ is a universal homeomorphism,
\item given a factorization $A \to C \to B$ such that
$\Spec(C) \to \Spec(A)$ is a universal homeomorphism, the
image of $C \to B$ is contained in $B'$.
\end{enumerate}
\end{lemma}

\begin{proof}
We will use Lemma \ref{lemma-reduction-universal-homeomorphism}
without further mention. Consider the commutative diagram
$$
\xymatrix{
B \ar[r] & B_{red} \\
A \ar[u] \ar[r] & A_{red} \ar[u]
}
$$
For any factorization $A \to C \to B$ of $A \to B$ as in (2), we see
that $A_{red} \to C_{red} \to B_{red}$ is a factorization of
$A_{red} \to B_{red}$ as in (2). It follows that if the
lemma holds for $A_{red} \to B_{red}$ and produces the $A_{red}$-subalgebra
$B'_{red} \subset B_{red}$, then setting $B' \subset B$
equal to the inverse image of $B'_{red}$ solves the lemma for
$A \to B$. This reduces us to the case discussed in the next paragraph.

\medskip\noindent
Assume $A$ and $B$ are reduced. In this case $A \subset B$ by
Algebra, Lemma \ref{algebra-lemma-image-dense-generic-points}.
Let $A \to C \to B$ be a factorization as in (2).
Then we may apply Proposition \ref{proposition-universal-homeomorphism}
to $A \subset C$ to see that every element of $C$ is contained
in an extension $A[c_1, \ldots, c_n] \subset C$ such that for
$i = 1, \ldots, n$ we have
\begin{enumerate}
\item $c_i^2, c_i^3 \in A[c_1, \ldots, c_{i - 1}]$, or
\item there exists a prime number $p$ with
$pc_i, c_i^p \in A[c_1, \ldots, c_{i - 1}]$.
\end{enumerate}
Thus property (2) holds if we define $B' \subset B$ to be the
subset of elements $b \in B$ which are contained in an extension
$
A[b_1, \ldots, b_n] \subset B
$
such that (*) holds: for $i = 1, \ldots, n$ we have
\begin{enumerate}
\item $b_i^2, b_i^3 \in A[b_1, \ldots, b_{i - 1}]$, or
\item there exists a prime number $p$ with
$pb_i, b_i^p \in A[b_1, \ldots, b_{i - 1}]$.
\end{enumerate}
There are only two things to check: (a) $B'$ is an $A$-subalgebra, and
(b) $\Spec(B') \to \Spec(A)$ is a universal homeomorphism.
Part (a) follows because given $n \geq 0$ and $b_1, \ldots, b_n \in B$
satisfying (*) and $m \geq 0$ and $b'_1, \ldots, b'_m \in B$
satisfying (*), the integer
$n + m$ and $b_1, \ldots, b_n, b'_1, \ldots, b'_m \in B$
also satisfies (*). Finally, part (b) holds by
Proposition \ref{proposition-universal-homeomorphism} and our construction
of $B'$.
\end{proof}

\begin{lemma}
\label{lemma-relative-weak-normalization-localization}
Let $A \to B$ be a ring map inducing a dominant morphism
$\Spec(B) \to \Spec(A)$ of spectra. Formation of the $A$-subalgebra
$B' \subset B$ in Lemma \ref{lemma-relative-weak-normalization-algebra}
commutes with localization (see proof for explanation).
\end{lemma}

\begin{proof}
Let $S \subset A$ be a multiplicative subset. Then $S^{-1}A \to S^{-1}B$ is a
ring map which induces a dominant morphism $\Spec(S^{-1}B) \to \Spec(S^{-1}A)$
as well (see Lemmas \ref{lemma-base-change-dominant} and
\ref{lemma-generalizations-lift-flat}).
Hence Lemma \ref{lemma-relative-weak-normalization-algebra}
produces an $S^{-1}A$-subalgebra $(S^{-1}B)' \subset S^{-1}B$.
The statement means that $S^{-1}B' = (S^{-1}B)'$ as $S^{-1}A$-subalgebras
of $S^{-1}B$.

\medskip\noindent
To see this is true, we will use the construction of $B'$ and
$(S^{-1}B)'$ in the proof of
Lemma \ref{lemma-relative-weak-normalization-algebra}.
In the first step, we see that $B'$ is the inverse image of
the $A_{red}$-subalgebra $B'_{red} \subset B_{red}$ constructed
for the ring map $A_{red} \to B_{red}$ and similarly for $(S^{-1}B)'$.
Noting that $S^{-1}B_{red} = (S^{-1}B)_{red}$ this reduces
us to the case discussed in the next paragraph.

\medskip\noindent
If $A$ and $B$ are reduced, we have constructed $B'$ as the union
of the subalgebras $A[b_1, \ldots, b_n]$ such that for $i = 1, \ldots, n$
we have
\begin{enumerate}
\item $b_i^2, b_i^3 \in A[b_1, \ldots, b_{i - 1}]$, or
\item there exists a prime number $p$ with
$pb_i, b_i^p \in A[b_1, \ldots, b_{i - 1}]$.
\end{enumerate}
Similarly for $(S^{-1}B)' \subset S^{-1}B$. Thus it is clear that the
image of $B' \to B \to S^{-1}B$ is contained in $(S^{-1}B)'$.
To show that the corresponding map $S^{-1}B' \to (S^{-1}B)'$
is surjective, one uses Lemma \ref{lemma-special-elements-and-localization}
to clear denominators successively; we omit the details.
\end{proof}

\begin{lemma}
\label{lemma-relative-seminormalization-algebra}
Let $A \to B$ be a ring map inducing a dominant morphism
$\Spec(B) \to \Spec(A)$ of spectra. There exists an $A$-subalgebra
$B' \subset B$ such that
\begin{enumerate}
\item $\Spec(B') \to \Spec(A)$ is a universal homeomorphism inducing
isomorphisms on residue fields,
\item given a factorization $A \to C \to B$ such that $\Spec(C) \to \Spec(A)$
is a universal homeomorphism inducing isomorphisms on residue fields,
the image of $C \to B$ is contained in $B'$.
\end{enumerate}
\end{lemma}

\begin{proof}
This proof is exactly the same as the proof of
Lemma \ref{lemma-relative-weak-normalization-algebra} except we use
Proposition \ref{proposition-universal-homeomorphism-equal-residue-fields}
in stead of Proposition \ref{proposition-universal-homeomorphism}
\end{proof}

\begin{lemma}
\label{lemma-relative-seminormalization-localization}
Let $A \to B$ be a ring map inducing a dominant morphism
$\Spec(B) \to \Spec(A)$ of spectra. Formation of the $A$-subalgebra
$B' \subset B$ in Lemma \ref{lemma-relative-seminormalization-algebra}
commutes with localization (see proof for explanation).
\end{lemma}

\begin{proof}
The proof is the same as the proof of
Lemma \ref{lemma-relative-weak-normalization-localization}.
\end{proof}

\begin{lemma}
\label{lemma-relative-seminormalization}
Let $f : Y \to X$ be a quasi-compact, quasi-separated, and dominant
morphism of schemes.
\begin{enumerate}
\item The category of factorizations $Y \to X' \to X$ where $X' \to X$
is a universal homeomorphism has an initial object $Y \to X^{Y/wn} \to X$.
\item The category of factorizations $Y \to X' \to X$ where $X' \to X$
is a universal homeomorphism inducing isomorphisms on residue fields
has an initial object $Y \to X^{Y/sn} \to X$.
\end{enumerate}
Moreover, formation of the factorization $Y \to X^{Y/wn} \to X$ and
$Y \to X^{Y/sn} \to X$ commutes with base change to open subschemes of $X$.
\end{lemma}

\begin{proof}
We will prove (1) and omit the proof of (2); also the final assertion
will follow from the construction of the factorization. We will use
Lemma \ref{lemma-universal-homeomorphism} without
further mention. First, let $Y \to X^{Y/n} \to X$ be the normalization
of $X$ in $Y$, see Definition \ref{definition-normalization-X-in-Y}.
For $Y \to X' \to X$ as in (1), we obtain a unique morphism
$X^{Y/n} \to X'$ compatible with the given morphisms, see
Lemma \ref{lemma-characterize-normalization}. Thus it suffices
to prove the lemma with $f$ replaced by $X^{Y/n} \to X$. This reduces
us to the case studied in the next paragraph.

\medskip\noindent
Assume $f$ is integral (the rest of the proof works more generally if
$f$ is affine). Let $U = \Spec(A)$ be an affine open of $X$ and let
$V = f^{-1}(U) = \Spec(B)$ be the inverse image in $Y$.
Then $A \to B$ is a ring map which induces a dominant morphism
on spectra. By Lemma \ref{lemma-relative-weak-normalization-algebra}
we obtain an $A$-subalgebra $B' \subset B$ such that setting
$U^{V/wn} = \Spec(B')$ the factorization $V \to U^{V/wn} \to U$
is initial in the category of factorizations $V \to U' \to U$ where
$U' \to U$ is a universal homeomorphism.

\medskip\noindent
If $U_1 \subset U_2 \subset X$ are affine opens, then setting
$V_i = f^{-1}(U_i)$ we obtain a canonical morphism
$$
\rho_{U_1}^{U_2} : U_1^{V_1/wn} \to U_1 \times_{U_2} U_2^{V_2/wn}
$$
over $U_1$ by the universal property of $U_1^{V_1/wn}$. These morphisms satisfy
a natural functoriality which we leave to the reader to formulate and prove.
Furthermore, the morphism $\rho_{U_1}^{U_2}$
is an isomorphism; this follows from
Lemma \ref{lemma-relative-weak-normalization-localization}
provided that $U_1 \subset U_2$ is a standard open
and in the general case can be reduced to this case
by the functorial nature of these maps and
Schemes, Lemma \ref{schemes-lemma-standard-open-two-affines}
(details omitted). Thus by relative glueing
(Constructions, Lemma \ref{constructions-lemma-relative-glueing})
we obtain a morphism $X^{Y/wn} \to X$ which restricts
to $U^{V/wn} \to U$ over $U$ compatibly with the $\rho_{U_1}^{U_2}$.
Of course, the morphisms $V \to U^{V/wn}$ glue to a morphism $Y \to X^{Y/wn}$
(see Constructions, Remark
\ref{constructions-remark-relative-glueing-functorial})
and we get our factorization $Y \to X^{Y/wn} \to X$ where the second morphism
is a universal homeomorphism.

\medskip\noindent
Finally, let $Y \to X' \to X$ be a factorization as in (1).
With $V \to U^{V/wn} \to U \subset X$ as above,
we obtain a factorization $V \to U \times_X X' \to U$ where
the second arrow is a universal homeomorphism
and we obtain a unique morphism $g_U : U^{V/wn} \to U \times_X X'$ over $U$
by the universal property of $U^{V/wn}$.
These $g_U$ are compatible with the morphisms $\rho_{U_1}^{U_2}$; details
omitted. Hence there is a unique morphism $g : X^{Y/wn} \to X'$
over $X$ agreeing with $g_U$ over $U$, see
Constructions, Remark \ref{constructions-remark-relative-glueing-functorial}.
This proves that $Y \to X^{Y/wn} \to X$ is initial in our category
and the proof is complete.
\end{proof}

\begin{definition}
\label{definition-relative-seminormalization}
Let $f : Y \to X$ be a quasi-compact, quasi-separated, and dominant
morphism of schemes.
\begin{enumerate}
\item The factorization $Y \to X^{Y/sn} \to X$ constructed in
Lemma \ref{lemma-relative-seminormalization} part (2)
is the {\it seminormalization of $X$ in $Y$}.
\item The factorization $Y \to X^{Y/wn} \to X$ constructed in
Lemma \ref{lemma-relative-seminormalization} part (1)
is the {\it weak normalization of $X$ in $Y$}.
\end{enumerate}
\end{definition}

\noindent
Here is a way to reinterpret the seminormalization of a scheme
which locally has finitely many irreducible components.

\begin{lemma}
\label{lemma-seminormal-and-normalization}
Let $X$ be a scheme such that every quasi-compact open has
finitely many irreducible components. Let $\nu : X^\nu \to X$
be the normalization of $X$. Then the seminormalization of $X$ in
$X^\nu$ is is the seminormalization of $X$. In a formula:
$X^{sn} = X^{X^\nu/sn}$.
\end{lemma}

\begin{proof}
Let $f : Y \to X$ be as in (\ref{equation-generic-points})
so that $X^\nu$ is the normalization of $X$ in $Y$.
The seminormalization $X^{sn} \to X$ of $X$ is the initial object in the
category of universal homeomorphisms $X' \to X$ inducing isomorphisms on
residue fields. Since $Y$ is the disjoint union of the spectra of the
residue fields at the generic points of irreducible components of $X$,
we see that for any $X' \to X$ in this category we obtain a canonical
lift $f' : Y \to X'$ of $f$. Then by
Lemma \ref{lemma-characterize-normalization}
we obtain a canonical morphism $X^\nu \to X'$.
Whence in turn a canonical morphism $X^{X^\nu/sn} \to X'$
by the universal property of $X^{X^\nu/sn}$.
In this way we see that $X^{X^\nu/sn}$ satisfies the
same universal property that $X^{sn}$ has and we conclude.
\end{proof}

\noindent
Lemma \ref{lemma-seminormal-and-normalization} motivates the
following definition. Since we have only constructed the
normalization in case $X$ locally has finitely many irreducible components,
we will also restrict ourselves to that case for the weak normalization.

\begin{definition}
\label{definition-weak-normalization}
Let $X$ be a scheme such that every quasi-compact open has
finitely many irreducible components. We define the
{\it weak normalization} of $X$ as the weak normalization
$$
X^\nu \longrightarrow X^{wn} \longrightarrow X
$$
of $X$ in the normalization $X^\nu$ of $X$
(Definition \ref{definition-normalization}).
In a formula: $X^{wn} = X^{X^\nu/wn}$.
\end{definition}

\noindent
Combined with Lemma \ref{lemma-seminormal-and-normalization} we see that
for a scheme $X$ which locally has finitely many irreducible components
there are canonical morphisms
$$
X^\nu \to X^{wn} \to X^{sn} \to X
$$
Having made this definition, we can say what it means for a scheme
to be weakly normal (provided it has locally finitely many irreducible
components).

\begin{definition}
\label{definition-weakly-normal}
Let $X$ be a scheme such that every quasi-compact open has
finitely many irreducible components. We say $X$ is {\it weakly normal}
if the weak normalization $X^{wn} \to X$ is an isomorphism
(Definition \ref{definition-weak-normalization}).
\end{definition}

\noindent
It follows immediately from the definitions that for a scheme $X$ such
that every quasi-compact open has finitely many irreducible components
we have
$$
X\text{ normal} \Rightarrow
X\text{ weakly normal} \Rightarrow
X\text{ seminormal}
$$
We can work out the meaning of weak normality in the affine case as follows.

\begin{lemma}
\label{lemma-affine-weakly-normal}
Let $X = \Spec(A)$ be an affine scheme which has finitely many
irreducible components. Then $X$ is weakly normal if and only if
\begin{enumerate}
\item $A$ is seminormal (Definition \ref{definition-seminormal-ring}),
\item for a prime number $p$ and $z, w \in A$ such that
(a) $z$ is a nonzerodivisor, (b) $w^p$ is divisible by $z^p$, and
(c) $pw$ is divisible by $z$, then $w$ is divisible by $z$.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume $X$ is weakly normal. Since a weakly normal scheme is seminormal,
we see that (1) holds (by our definition of weakly normal schemes).
In particular $A$ is reduced. Let $p, z, w$ be as in (2).
Choose $x, y \in A$ such that $z^p x = w^p$ and $zy = pw$.
Then $p^p x = y^p$. The ring map
$A \to C = A[t]/(t^p - x, pt - y)$ induces a universal homeomorphism
on spectra. The normalization $X^\nu$ of $X$
is the spectrum of the integral closure $A'$
of $A$ in the total ring of fractions of $A$, see
Lemma \ref{lemma-description-normalization}.
Note that $a = w/z \in A'$ because $a^p = x$.
Hence we have an $A$-algebra homomorphism $A \to C \to A'$
sending $t$ to $a$.
At this point the defining property $X = X^{wn} = X^{X^\nu/wn}$
of being weakly normal tells us that $C \to A'$ maps into $A$.
Thus we find $a \in A$ as desired.

\medskip\noindent
Conversely, assume (1) and (2). Let $A'$ be as in the previous paragraph.
We have to show that $X^{X^\nu/wn} = X$. By construction in the proof
of Lemma \ref{lemma-relative-weak-normalization-algebra}, the scheme
$X^{X^\nu/wn}$ is the spectrum of the subring of $A'$
which is the union of the subrings $A[a_1, \ldots, a_n] \subset A'$
such that for $i = 1, \ldots, n$ we have
\begin{enumerate}
\item[(a)] $a_i^2, a_i^3 \in A[a_1, \ldots, a_{i - 1}]$, or
\item[(b)] there exists a prime number $p$ with
$pa_i, a_i^p \in A[a_1, \ldots, a_{i - 1}]$.
\end{enumerate}
Then we can use (1) and (2) to inductively see that $a_1, \ldots, a_n \in A$;
we omit the details. Consequently, we have $X = X^{X^\nu/wn}$ and hence
$X$ is weakly normal.
\end{proof}

\noindent
Here is the obligatory lemma.

\begin{lemma}
\label{lemma-locally-weakly-normal}
Let $X$ be a scheme such that every quasi-compact open has
finitely many irreducible components. The following are equivalent:
\begin{enumerate}
\item The scheme $X$ is weakly normal.
\item For every affine open $U \subset X$ the ring $\mathcal{O}_X(U)$
satisfies conditions (1) and (2) of Lemma \ref{lemma-affine-weakly-normal}.
\item There exists an affine open covering $X = \bigcup U_i$ such that
each ring $\mathcal{O}_X(U_i)$
satisfies conditions (1) and (2) of Lemma \ref{lemma-affine-weakly-normal}.
\item There exists an open covering $X = \bigcup X_j$
such that each open subscheme $X_j$ is weakly normal.
\end{enumerate}
Moreover, if $X$ is weakly normal then every open subscheme is weakly normal.
\end{lemma}

\begin{proof}
The condition to $X$ be weakly normal is that the morphism
$X^{wn} = X^{X^\nu/wn} \to X$ is an isomorphism. Since the construction
of $X^\nu \to X$ commutes with base change to open subschemes
and since the construction of $X^{X^\nu/wn}$ commutes with base
change to open subschemes of $X$ (Lemma \ref{lemma-relative-seminormalization})
the lemma is clear.
\end{proof}










\section{Zariski's Main Theorem (algebraic version)}
\label{section-Zariski}

\noindent
This is the version you can prove using purely algebraic methods.
Before we can prove more powerful versions (for non-affine morphisms)
we need to develop more tools. See Cohomology of Schemes, Section
\ref{coherent-section-applications-formal-functions}
and
More on Morphisms, Section
\ref{more-morphisms-section-application-etale-neighbourhoods}.

\begin{theorem}[Algebraic version of Zariski's Main Theorem]
\label{theorem-main-theorem}
Let $f : Y \to X$ be an affine morphism of schemes.
Assume $f$ is of finite type.
Let $X'$ be the normalization of $X$ in $Y$. Picture:
$$
\xymatrix{
Y \ar[rd]_f \ar[rr]_{f'} & & X' \ar[ld]^\nu \\
& X &
}
$$
Then there exists an open subscheme $U' \subset X'$ such that
\begin{enumerate}
\item $(f')^{-1}(U') \to U'$ is an isomorphism, and
\item $(f')^{-1}(U') \subset Y$ is the set of points at which
$f$ is quasi-finite.
\end{enumerate}
\end{theorem}

\begin{proof}
There is an immediate reduction to the case where $X$ and hence $Y$
are affine. Say $X = \Spec(R)$ and $Y = \Spec(A)$.
Then $X' = \Spec(A')$, where $A'$ is the integral closure of
$R$ in $A$, see Definitions \ref{definition-integral-closure}
and \ref{definition-normalization-X-in-Y}. By
Algebra, Theorem \ref{algebra-theorem-main-theorem}
for every $y \in Y$ at which $f$ is quasi-finite, there exists an
open $U'_y \subset X'$ such that $(f')^{-1}(U'_y) \to U'_y$
is an isomorphism. Set $U' = \bigcup U'_y$ where $y \in Y$ ranges
over all points where $f$ is quasi-finite. It remains to show that
$f$ is quasi-finite at all points of $(f')^{-1}(U')$.
If $y \in (f')^{-1}(U')$ with image $x \in X$, then we see that
$Y_x \to X'_x$ is an isomorphism in a neighbourhood of $y$. Hence
there is no point of $Y_x$ which specializes to $y$, since this
is true for $f'(y)$ in $X'_x$, see Lemma \ref{lemma-integral-fibres}.
By Lemma \ref{lemma-quasi-finite-at-point-characterize} part (3)
this implies $f$ is quasi-finite at $y$.
\end{proof}

\noindent
We can use the algebraic version of Zariski's Main Theorem to show that
the set of points where a morphism is quasi-finite is open.

\begin{lemma}
\label{lemma-quasi-finite-points-open}
\begin{slogan}
The locally quasi-finite locus of a morphism is open
\end{slogan}
Let $f : X \to S$ be a morphism of schemes.
The set of points of $X$ where $f$ is quasi-finite is an open
$U \subset X$. The induced morphism $U \to S$ is locally quasi-finite.
\end{lemma}

\begin{proof}
Suppose $f$ is quasi-finite at $x$.
Let $x \in U = \Spec(A) \subset X$, $V = \Spec(R) \subset S$
be affine opens as in Definition \ref{definition-quasi-finite}.
By either Theorem \ref{theorem-main-theorem} above or
Algebra, Lemma \ref{algebra-lemma-quasi-finite-open},
the set of primes $\mathfrak q$ at which $R \to A$ is quasi-finite
is open in $\Spec(A)$. Since these all correspond to points
of $X$ where $f$ is quasi-finite we get the first statement.
The second statement is obvious.
\end{proof}

\noindent
We will improve the following lemma to general quasi-finite separated
morphisms later, see
More on Morphisms, Lemma
\ref{more-morphisms-lemma-quasi-finite-separated-pass-through-finite}.

\begin{lemma}
\label{lemma-quasi-finite-affine}
Let $f : Y \to X$ be a morphism of schemes.
Assume
\begin{enumerate}
\item $X$ and $Y$ are affine, and
\item $f$ is quasi-finite.
\end{enumerate}
Then there exists a diagram
$$
\xymatrix{
Y \ar[rd]_f \ar[rr]_j & & Z \ar[ld]^\pi \\
& X &
}
$$
with $Z$ affine, $\pi$ finite and $j$ an open immersion.
\end{lemma}

\begin{proof}
This is
Algebra, Lemma \ref{algebra-lemma-quasi-finite-open-integral-closure}
reformulated in the language of schemes.
\end{proof}

\begin{lemma}
\label{lemma-image-nowhere-dense-quasi-finite}
Let $f : Y \to X$ be a quasi-finite morphism of schemes.
Let $T \subset Y$ be a closed nowhere dense subset of $Y$.
Then $f(T) \subset X$ is a nowhere dense subset of $X$.
\end{lemma}

\begin{proof}
As in the proof of Lemma \ref{lemma-image-nowhere-dense-finite} this
reduces immediately to the case where the base $X$ is affine.
In this case $Y = \bigcup_{i = 1, \ldots, n} Y_i$ is a finite union
of affine opens (as $f$ is quasi-compact). Since each $T \cap Y_i$
is nowhere dense, and since a finite union of nowhere dense sets is
nowhere dense (see
Topology, Lemma \ref{topology-lemma-nowhere-dense}),
it suffices to prove that the image $f(T \cap Y_i)$ is nowhere dense in $X$.
This reduces us to the case where both $X$ and $Y$ are affine. At this point
we apply Lemma \ref{lemma-quasi-finite-affine} above to get a diagram
$$
\xymatrix{
Y \ar[rd]_f \ar[rr]_j & & Z \ar[ld]^\pi \\
& X &
}
$$
with $Z$ affine, $\pi$ finite and $j$ an open immersion.
Set $\overline{T} = \overline{j(T)} \subset Z$. By
Topology, Lemma \ref{topology-lemma-image-nowhere-dense-open}
we see $\overline{T}$ is nowhere dense in $Z$.
Since $f(T) \subset \pi(\overline{T})$
the lemma follows from the corresponding result in the finite case, see
Lemma \ref{lemma-image-nowhere-dense-finite}.
\end{proof}




\section{Universally bounded fibres}
\label{section-universally-bounded}

\noindent
Let $X$ be a scheme over a field $k$. If $X$ is finite over $k$,
then $X = \Spec(A)$ where $A$ is a finite $k$-algebra. Another way
to say this is that $X$ is finite locally free over $\Spec(k)$,
see Definition \ref{definition-finite-locally-free}. Hence
$X \to \Spec(k)$ has a {\it degree} which is an integer $d \geq 0$,
namely $d = \dim_k(A)$. We sometime call this the {\it degree} of the (finite)
scheme $X$ over $k$.

\begin{definition}
\label{definition-universally-bounded}
Let $f : X \to Y$ be a morphism of schemes.
\begin{enumerate}
\item We say the integer $n$ {\it bounds the degrees of the fibres
of $f$} if for all $y \in Y$
the fibre $X_y$ is a finite scheme over $\kappa(y)$ whose
degree over $\kappa(y)$ is $\leq n$.
\item We say the {\it fibres of $f$ are universally bounded}\footnote{This is
probably nonstandard notation.}
if there exists an integer $n$ which bounds the degrees of the fibres
of $f$.
\end{enumerate}
\end{definition}

\noindent
Note that in particular the number of points in a fibre is bounded by $n$
as well. (The converse does not hold, even if all fibres are finite reduced
schemes.)

\begin{lemma}
\label{lemma-characterize-universally-bounded}
Let $f : X \to Y$ be a morphism of schemes. Let $n \geq 0$.
The following are equivalent:
\begin{enumerate}
\item the integer $n$ bounds the degrees of the fibres of $f$, and
\item for every morphism $\Spec(k) \to Y$, where $k$ is a field,
the fibre product $X_k = \Spec(k) \times_Y X$ is finite over $k$
of degree $\leq n$.
\end{enumerate}
In this case the fibres of $f$ are universally bounded and the schemes
$X_k$ have at most $n$ points. More precisely, if
$X_k = \{x_1, \ldots, x_t\}$, then we have
$$
n \geq \sum\nolimits_{i = 1, \ldots, t} [\kappa(x_i) : k]
$$
\end{lemma}

\begin{proof}
The implication (2) $\Rightarrow$ (1) is trivial. The other implication
holds because if the image of $\Spec(k) \to Y$ is $y$, then
$X_k = \Spec(k) \times_{\Spec(\kappa(y))} X_y$. By definition the
fibres of $f$ being universally bounded means that some $n$ exists.
Finally, suppose that $X_k = \Spec(A)$. Then $\dim_k A = n$.
Hence $A$ is Artinian, all prime ideals are maximal ideals $\mathfrak m_i$,
and $A$ is the product of the localizations at these maximal ideals.
See Algebra, Lemmas \ref{algebra-lemma-finite-dimensional-algebra}
and \ref{algebra-lemma-artinian-finite-length}. Then $\mathfrak m_i$
corresponds to $x_i$, we have
$A_{\mathfrak m_i} = \mathcal{O}_{X_k, x_i}$
and hence there is a surjection
$A \to  \bigoplus \kappa(\mathfrak m_i) = \bigoplus \kappa(x_i)$
which implies the inequality in the statement of the lemma
by linear algebra.
\end{proof}

\begin{lemma}
\label{lemma-finite-locally-free-universally-bounded}
If $f$ is a finite locally free morphism of degree $d$, then
$d$ bounds the degree of the fibres of $f$.
\end{lemma}

\begin{proof}
This is true because any base change of $f$ is
finite locally free of degree $d$
(Lemma \ref{lemma-base-change-finite-locally-free})
and hence the fibres of $f$ all have degree $d$.
\end{proof}

\begin{lemma}
\label{lemma-composition-universally-bounded}
A composition of morphisms with universally bounded fibres
is a morphism with universally bounded fibres. More precisely,
assume that $n$ bounds the degrees of the fibres of $f : X \to Y$ and
$m$ bounds the degrees of $g : Y \to Z$.
Then $nm$ bounds the degrees of the fibres of $g \circ f : X \to Z$.
\end{lemma}

\begin{proof}
Let $f : X \to Y$ and $g : Y \to Z$ have universally bounded fibres.
Say that $\deg(X_y/\kappa(y)) \leq n$ for all $y \in Y$, and that
$\deg(Y_z/\kappa(z)) \leq m$ for all $z \in Z$.
Let $z \in Z$ be a point. By assumption the scheme
$Y_z$ is finite over $\Spec(\kappa(z))$.
In particular, the underlying topological space of $Y_z$
is a finite discrete set. The fibres of the morphism
$f_z : X_z \to Y_z$ are the fibres of $f$ at the corresponding
points of $Y$, which are finite discrete sets by the reasoning above.
Hence we conclude that the underlying topological space
of $X_z$ is a finite discrete set as well. Thus $X_z$ is an affine
scheme (this is a nice exercise; it also follows for example from
Properties, Lemma \ref{properties-lemma-maximal-points-affine}
applied to the set of all points of $X_z$). Write $X_z = \Spec(A)$,
$Y_z = \Spec(B)$, and $k = \kappa(z)$. Then $k \to B \to A$
and we know that (a) $\dim_k(B) \leq m$, and (b) for every maximal
ideal $\mathfrak m \subset B$ we have
$\dim_{\kappa(\mathfrak m)}(A/\mathfrak mA) \leq n$.
We claim this implies that $\dim_k(A) \leq nm$.
Note that $B$ is the product of its localizations $B_{\mathfrak m}$, for
example because $Y_z$ is a disjoint union of $1$-point schemes, or by
Algebra, Lemmas \ref{algebra-lemma-finite-dimensional-algebra} and
\ref{algebra-lemma-artinian-finite-length}.
So we see that
$\dim_k(B) = \sum_{\mathfrak m} \dim_k(B_{\mathfrak m})$ and
$\dim_k(A) = \sum_{\mathfrak m} \dim_k(A_{\mathfrak m})$ where
in both cases $\mathfrak m$ runs over the maximal ideals of
$B$ (not of $A$). By the above, and Nakayama's Lemma
(Algebra, Lemma \ref{algebra-lemma-NAK})
we see that each $A_{\mathfrak m}$ is a quotient of
$B_{\mathfrak m}^{\oplus n}$ as a $B_{\mathfrak m}$-module. Hence
$\dim_k(A_{\mathfrak m}) \leq n \dim_k(B_{\mathfrak m})$. Putting
everything together we see that
$$
\dim_k(A) = \sum\nolimits_{\mathfrak m} \dim_ta	(A_{\mathfrak m})
\leq \sum\nolimits_{\mathfrak m} n \dim_k(B_{\mathfrak m})
= n \dim_k(B) \leq nm
$$
as desired.
\end{proof}

\begin{lemma}
\label{lemma-base-change-universally-bounded}
A base change of a morphism with universally bounded fibres is
a morphism with universally bounded fibres. More precisely, if
$n$ bounds the degrees of the fibres of $f : X \to Y$ and $Y' \to Y$
is any morphism, then the degrees of the fibres of the base change
$f' : Y' \times_Y X \to Y'$ is also bounded by $n$.
\end{lemma}

\begin{proof}
This is clear from the result of
Lemma \ref{lemma-characterize-universally-bounded}.
\end{proof}

\begin{lemma}
\label{lemma-descent-universally-bounded}
Let $f : X \to Y$ be a morphism of schemes.
Let $Y' \to Y$ be a morphism of schemes, and let
$f' : X' = X_{Y'} \to Y'$ be the base change of $f$.
If $Y' \to Y$ is surjective and $f'$ has universally bounded fibres,
then $f$ has universally bounded fibres. More precisely, if $n$ bounds
the degree of the fibres of $f'$, then also $n$ bounds the degrees
of the fibres of $f$.
\end{lemma}

\begin{proof}
Let $n \geq 0$ be an integer bounding the degrees of the fibres of $f'$.
We claim that $n$ works for $f$ also. Namely, if $y \in Y$ is a point,
then choose a point $y' \in Y'$ lying over $y$ and observe that
$$
X'_{y'} = \Spec(\kappa(y')) \times_{\Spec(\kappa(y))} X_y.
$$
Since $X'_{y'}$ is assumed finite of degree $\leq n$ over $\kappa(y')$
it follows that also $X_y$ is finite of degree $\leq n$ over $\kappa(y)$.
(Some details omitted.)
\end{proof}

\begin{lemma}
\label{lemma-immersion-universally-bounded}
An immersion has universally bounded fibres.
\end{lemma}

\begin{proof}
The integer $n = 1$ works in the definition.
\end{proof}

\begin{lemma}
\label{lemma-etale-universally-bounded}
Let $f : X \to Y$ be an \'etale morphism of schemes.
Let $n \geq 0$. The following are equivalent
\begin{enumerate}
\item the integer $n$ bounds the degrees of the fibres,
\item for every field $k$ and morphism $\Spec(k) \to Y$ the
base change $X_k = \Spec(k) \times_Y X$ has at most $n$ points, and
\item for every $y \in Y$ and every separable algebraic closure
$\kappa(y) \subset \kappa(y)^{sep}$ the scheme
$X_{\kappa(y)^{sep}}$ has at most $n$ points.
\end{enumerate}
\end{lemma}

\begin{proof}
This follows from
Lemma \ref{lemma-characterize-universally-bounded}
and the fact that the fibres $X_y$ are disjoint unions of spectra of finite
separable field extensions of $\kappa(y)$, see
Lemma \ref{lemma-etale-over-field}.
\end{proof}

\noindent
Having universally bounded fibres is an absolute notion and not a relative
notion. This is why the condition in the following lemma is that $X$ is
quasi-compact, and not that $f$ is quasi-compact.

\begin{lemma}
\label{lemma-locally-quasi-finite-qc-source-universally-bounded}
Let $f : X \to Y$ be a morphism of schemes.
Assume that
\begin{enumerate}
\item $f$ is locally quasi-finite, and
\item $X$ is quasi-compact.
\end{enumerate}
Then $f$ has universally bounded fibres.
\end{lemma}

\begin{proof}
Since $X$ is quasi-compact, there exists a finite affine open covering
$X = \bigcup_{i = 1, \ldots, n} U_i$ and affine opens $V_i \subset Y$,
$i = 1, \ldots, n$ such that $f(U_i) \subset V_i$.
Because of the local nature of ``local quasi-finiteness''
(see Lemma \ref{lemma-quasi-finite-at-point-characterize} part (4))
we see that the morphisms $f|_{U_i} : U_i \to V_i$ are locally
quasi-finite morphisms of affines, hence quasi-finite, see
Lemma \ref{lemma-quasi-finite-locally-quasi-compact}.
For $y \in Y$ it is clear that $X_y = \bigcup_{y \in V_i} (U_i)_y$
is an open covering. Hence it suffices to prove the lemma
for a quasi-finite morphism of affines (namely, if $n_i$ works
for the morphism $f|_{U_i} : U_i \to V_i$, then $\sum n_i$
works for $f$).

\medskip\noindent
Assume $f : X \to Y$ is a quasi-finite morphism of affines.
By Lemma \ref{lemma-quasi-finite-affine}
we can find a diagram
$$
\xymatrix{
X \ar[rd]_f \ar[rr]_j & & Z \ar[ld]^\pi \\
& Y &
}
$$
with $Z$ affine, $\pi$ finite and $j$ an open immersion. Since
$j$ has universally bounded fibres
(Lemma \ref{lemma-immersion-universally-bounded})
this reduces us to showing that $\pi$ has universally bounded
fibres (Lemma \ref{lemma-composition-universally-bounded}).

\medskip\noindent
This reduces us to a morphism of the form
$\Spec(B) \to \Spec(A)$ where
$A \to B$ is finite. Say $B$ is generated by $x_1, \ldots, x_n$
over $A$ and say $P_i(T) \in A[T]$ is a monic polynomial of degree
$d_i$ such that $P_i(x_i) = 0$ in $B$ (a finite ring extension
is integral, see
Algebra, Lemma \ref{algebra-lemma-finite-is-integral}).
With these notations it is clear that
$$
\bigoplus\nolimits_{0 \leq e_i < d_i, i = 1, \ldots n} A
\longrightarrow
B, \quad
(a_{(e_1, \ldots, e_n)}) \longmapsto
\sum a_{(e_1, \ldots, e_n)} x_1^{e_1} \ldots x_n^{e_n}
$$
is a surjective $A$-module map. Thus for any prime $\mathfrak p \subset A$
this induces a surjective map $\kappa(\mathfrak p)$-vector spaces
$$
\kappa(\mathfrak p)^{\oplus d_1 \ldots d_n} \longrightarrow
B \otimes_A \kappa(\mathfrak p)
$$
In other words, the integer $d_1 \ldots d_n$ works in the definition
of a morphism with universally bounded fibres.
\end{proof}

\begin{lemma}
\label{lemma-universally-bounded-permanence}
Consider a commutative diagram of morphisms of schemes
$$
\xymatrix{
X \ar[rd]_g \ar[rr]_f & & Y \ar[ld]^h \\
& Z &
}
$$
If $g$ has universally bounded fibres, and $f$ is surjective and flat,
then also $h$ has universally bounded fibres. More precisely, if $n$
bounds the degree of the fibres of $g$, then also $n$ bounds the
degree of the fibres of $h$.
\end{lemma}

\begin{proof}
Assume $g$ has universally bounded fibres, and $f$ is surjective and flat.
Say the degree of the fibres of $g$ is bounded by $n \in \mathbf{N}$.
We claim $n$ also works for $h$.
Let $z \in Z$. Consider the morphism of schemes $X_z \to Y_z$.
It is flat and surjective. By assumption $X_z$ is a finite scheme
over $\kappa(z)$, in particular it is the spectrum of an
Artinian ring (by
Algebra, Lemma \ref{algebra-lemma-finite-dimensional-algebra}).
By Lemma \ref{lemma-Artinian-affine} the morphism $X_z \to Y_z$ is affine
in particular quasi-compact. It follows from
Lemma \ref{lemma-fpqc-quotient-topology}
that $Y_z$ is a finite discrete as this holds for $X_z$.
Hence $Y_z$ is an affine scheme (this is a nice exercise; it also follows
for example from
Properties, Lemma \ref{properties-lemma-maximal-points-affine}
applied to the set of all points of $Y_z$).
Write $Y_z = \Spec(B)$ and $X_z = \Spec(A)$.
Then $A$ is faithfully flat over $B$, so $B \subset A$.
Hence $\dim_k(B) \leq \dim_k(A) \leq n$ as desired.
\end{proof}





\section{Miscellany}
\label{section-misc}

\noindent
Results which do not fit elsewhere.

\begin{lemma}
\label{lemma-factor-through-point}
Let $f : Y \to X$ be a morphism of schemes. Let $x \in X$ be a point.
Assume that $Y$ is reduced and $f(Y)$ is set-theoretically contained
in $\{x\}$. Then $f$ factors through the canonical morphism
$x = \Spec(\kappa(x)) \to X$.
\end{lemma}

\begin{proof}
Omitted. Hints: working affine locally one reduces to a commutative algebra
lemma. Given a ring map $A \to B$ with $B$ reduced such that there exists
a unique prime ideal $\mathfrak p \subset A$ in the image of
$\Spec(B) \to \Spec(A)$, then $A \to B$ factors through $\kappa(\mathfrak p)$.
This is a nice exercise.
\end{proof}

\begin{lemma}
\label{lemma-factor-through-set-of-points}
Let $f : Y \to X$ be a morphism of schemes. Let $E \subset X$.
Assume $X$ is locally Noetherian, there are no nontrivial specializations
among the elements of $E$, $Y$ is reduced, and $f(Y) \subset E$.
Then $f$ factors through $\coprod_{x \in E} x \to X$.
\end{lemma}

\begin{proof}
When $E$ is a singleton this follows from
Lemma \ref{lemma-factor-through-point}. If $E$ is finite, then $E$
(with the induced topology of $X$) is a finite discrete space by
our assumption on specializations. Hence this case reduces to the
singleton case. In general, there is a reduction to the
case where $X$ and $Y$ are affine schemes. Say $f : Y \to X$ corresponds to
the ring map $\varphi : A \to B$. Denote $A' \subset B$ the image of $\varphi$.
Let $E' \subset \Spec(A') \subset \Spec(A)$ be the set of minimal primes
of $A'$. By Algebra, Lemma \ref{algebra-lemma-injective-minimal-primes-in-image}
the set $E'$ is contained in the image of
$\Spec(B) \to \Spec(A') \subset \Spec(A)$. We conclude that $E' \subset E$.
Since $A'$ is Noetherian we have $E'$ is finite by Algebra, Lemma
\ref{algebra-lemma-Noetherian-irreducible-components}.
Since any other point in the image of $\Spec(B) \to \Spec(A)$ is
a specialization of an element of $E'$ and in $E$, we conclude that
the image is contained in $E'$ (by our assumption on specializations between
points of $E$). Thus we reduce to the case where
$E$ is finite which we dealt with above.
\end{proof}




\input{chapters}

\bibliography{my}
\bibliographystyle{amsalpha}

\end{document}
